Visitor.h 535 B

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include "Element.h"
  3. class Element;
  4. class Visitor {
  5. public:
  6. virtual ~Visitor();
  7. virtual void VisitConcreteElementA(Element* elm) = 0;
  8. virtual void VisitConcreteElementB(Element* elm) = 0;
  9. protected:
  10. Visitor();
  11. };
  12. class ConcreteVisitorA :public Visitor {
  13. public:
  14. void VisitConcreteElementA(Element* elm);
  15. void VisitConcreteElementB(Element* elm);
  16. };
  17. class ConcreteVisitorB :public Visitor {
  18. public:
  19. void VisitConcreteElementA(Element* elm);
  20. void VisitConcreteElementB(Element* elm);
  21. };