Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class A
- {
- public:
- double x;
- virtual~A();
- virtual void getX()=0;
- A(double Z){this->x=Z;}
- };
- class B : public A
- {
- public:
- B(double Q):A(Q){std::cout<<"Counstructed"<<'\n';}
- ~B()override
- {
- std::cout<<"Destructed"<<"\n";
- }
- void getX() override
- {
- std::cout<<this->x<<"\n";
- }
- };
- int main()
- {
- B test(1.1);
- test.getX();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement