Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class P1{
- public:
- virtual void display(){
- cout<<"Count the valu"<<endl;
- }
- };
- class P2: public P1{
- void display(){
- cout<<"Count the second value"<<endl;
- }
- };
- class P3:public P1{
- void display(){
- cout<<"Count value"<<endl;
- }
- };
- int main(){
- P1 *p;
- P2 q;
- P3 r;
- p=&q;
- p->display();
- p=&r;
- p->display();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement