Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. class A
  9. {
  10.  
  11. public:
  12. virtual void f() {
  13. printf <"~A.f "> ;
  14. }
  15. virtual ~A() {f();}
  16. };
  17.  
  18.  
  19.  
  20. class B : public A{
  21.  
  22.  
  23. public:
  24. void f ()
  25. {printf<"~B.f ">;}
  26. ~B(){f();}
  27.  
  28. };
  29.  
  30.  
  31. B b;
  32. int main()
  33. {
  34. A*a=new B();
  35. printf ("M ");
  36. delete a;
  37. return 0;
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement