Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <iostream>
- #include <string>
- using namespace std;
- class A
- {
- public:
- virtual void f() {
- printf <"~A.f "> ;
- }
- virtual ~A() {f();}
- };
- class B : public A{
- public:
- void f ()
- {printf<"~B.f ">;}
- ~B(){f();}
- };
- B b;
- int main()
- {
- A*a=new B();
- printf ("M ");
- delete a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement