Friday, 27 April 2012

Program Of Multiple Inheritance In C++

#include<iostream.h>
#include<conio.h>
class base
{
private:
int a;
public:
{
a=x;
}
void displayb()
{
cout<<"\n base value is="<<a;
}
} ;

class derive
{
private:
int b;
public:
void getdatad(int y)
{
b=y;
}
{
cout<<"\n derive value is="<<b;
}
} ;

class derive1 : public base, public derive     // Multiple Inheritence
{
private:
int c;
public:
void getdatad1(int z)
{
c=z;
}
{
cout<<"\n derive1 value is="<<c;
}
} ;

main()
{
clrscr();
derive1 d1;
d1.getdatab(5);
d1.getdatad(7);
d1.getdatad1(9);
d1.displayb();
d1.displayd();
d1.displayd1();
getch();
}

No comments:

Post a Comment