Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----
- #include <iostream>
- class Base
- {
- public:
- Base() { std::cout << "Base constructor\n" << std::endl; }
- ~Base() { std::cout << "Base destructor\n" << std::endl; }
- };
- class Derive : public Base
- {
- public:
- Derive() { std::cout << "Derive contructor\n" << std::endl; }
- virtual ~Derive() { std::cout << "Derive destructor\n" << std::endl; }
- };
- int main()
- {
- Base * ptr = new Derive;
- delete ptr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement