Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. -----
  2. #include <iostream>
  3.  
  4. class Base
  5. {
  6. public:
  7.   Base() { std::cout << "Base constructor\n" << std::endl; }
  8.   ~Base() { std::cout << "Base destructor\n" << std::endl; }
  9. };
  10.  
  11. class Derive : public Base
  12. {
  13. public:
  14.   Derive() { std::cout << "Derive contructor\n" << std::endl; }
  15.   virtual ~Derive() { std::cout << "Derive destructor\n" << std::endl; }
  16. };
  17.  
  18. int main()
  19. {
  20.   Base * ptr = new Derive;
  21.   delete ptr;
  22.   return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement