Guest User

Untitled

a guest
Jan 17th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. class GenericSymbolGenerator {
  2. protected: // <== ok
  3. ~GenericSymbolGenerator(void) {}
  4.  
  5. public:
  6. virtual GenericSymbolTableCollection* generateSymbolTableCollection(GenericSymbolTableCollection *gst) = 0;
  7. GenericSymbolGenerator(void) {}
  8. // ~GenericSymbolGenerator(void) {} // <== warning if used
  9. };
  10.  
  11. class PascalPredefinedSymbolGenerator : public GenericSymbolGenerator {
  12. protected:
  13. ~PascalPredefinedSymbolGenerator(void) {} // <== ok
  14.  
  15. public:
  16. GenericSymbolTableCollection* generateSymbolTableCollection(GenericSymbolTableCollection *pst); // initializes *pst
  17. PascalPredefinedSymbolGenerator(void) {}
  18. // ~PascalPredefinedSymbolGenerator(void) {} <== warning if used
  19. };
  20.  
  21. class PascalSymbolGenerator : public GenericSymbolGenerator {
  22. protected:
  23. ~PascalSymbolGenerator(void) {} // <== ok
  24.  
  25. public:
  26. GenericSymbolTableCollection* generateSymbolTableCollection(GenericSymbolTableCollection *st); // initializes st
  27. PascalSymbolGenerator(void) {}
  28. // ~PascalSymbolGenerator(void) {} // <== warning if used
  29. };
  30.  
  31. GenericSymbolGenerator *ptr = new PascalPredefinedSymbolGenerator();
  32. delete ptr; // behavior is undefined, we tried to call the base class destructor
Add Comment
Please, Sign In to add comment