SHARE
TWEET

Untitled

a guest Dec 8th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. class A
  4. {
  5. public:
  6.     double x;
  7.     virtual~A();
  8.     virtual void getX()=0;
  9.     A(double Z){this->x=Z;}
  10. };
  11.  
  12. class B : public A
  13. {
  14. public:
  15.     B(double Q):A(Q){std::cout<<"Counstructed"<<'\n';}
  16.    
  17.     ~B()override
  18.     {
  19.         std::cout<<"Destructed"<<"\n";
  20.     }
  21.     void getX() override
  22.     {
  23.         std::cout<<this->x<<"\n";
  24.     }
  25. };
  26.  
  27.  
  28. int main()
  29. {
  30.     B test(1.1);
  31.     test.getX();
  32.    
  33.     return 0;
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top