Thursday, 20 July 2017

program of inheritance

#include<iostream.h>
#include<conio.h>
class a
{
int x;
protected:
int d;
int y;
};



class b
{      int a;
protected:
int b;
int f;

};
class c:public a,public b
{
int p;
public:
     int q;
     void getdata()
     {
cout<<"enter the value of x \n";
cin>>d;
cout<<"enter the value of y \n";
cin>>y;
     }

     void show()
     {
     cout<<d<<y;
     }
};
void main()
{
clrscr();
a obj1;
b obj2;
c obj3;
obj3.getdata();
obj3.show();
getch();
}

No comments:

Post a Comment