Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. using namespace std;
  2.  
  3. int x = 1;
  4.  
  5. class A {
  6. public:
  7.     ~A(){
  8.         x = 2
  9.     }
  10. };
  11.  
  12. class B : public A {
  13. public:
  14.     ~B(){
  15.         x = 3;
  16.     }
  17. };
  18.  
  19. int main() {
  20.     A* foo = new B();
  21.     delete foo;
  22.     std::cout << x;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement