//Multiple Inheritance
#include<iostream.h>
#include<conio.h>
class A
{
protected:
int a;
};
class B
{
protected:
int b;
};
class C
{
protected:
int c;
};
class D
{
protected:
int d;
};
class E:public A,B,C,D
{
int e;
public:
void getdata()
{
cout<<"Enter the values of a,b,c,d & e"<<endl;
cin>>a>>b>>c>>d>>e;
}
void showdata()
{
cout<<"\na="<<a<<endl;
cout<<"\nb="<<b<<endl;
cout<<"\nc="<<c<<endl;
cout<<"\nd="<<d<<endl;
cout<<"\ne="<<e<<endl;
}
};
void main()
{
//clrscr();
E x;
x.getdata();
x.showdata();
getch();
}
#include<iostream.h>
#include<conio.h>
class A
{
protected:
int a;
};
class B
{
protected:
int b;
};
class C
{
protected:
int c;
};
class D
{
protected:
int d;
};
class E:public A,B,C,D
{
int e;
public:
void getdata()
{
cout<<"Enter the values of a,b,c,d & e"<<endl;
cin>>a>>b>>c>>d>>e;
}
void showdata()
{
cout<<"\na="<<a<<endl;
cout<<"\nb="<<b<<endl;
cout<<"\nc="<<c<<endl;
cout<<"\nd="<<d<<endl;
cout<<"\ne="<<e<<endl;
}
};
void main()
{
//clrscr();
E x;
x.getdata();
x.showdata();
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.