Saturday, 28 April 2012

Program Of Single 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 : public base     // Single Inheritence
{
private:
int b;
public:
void getdatad(int y)
{
b=y;
}
void displayd()
{
cout<<"\n derive value is="<<b;
}
} ;

main()
{
clrscr();
derive d1;
d1.getdatab(5);
d1.getdatad(7);
d1.displayb();
d1.displayd();

getch();
}
--------------------------------------------------
Single Inheritance

Multiple inheritance is a feature of some object-oriented 

computer programming languages in which a class can 

inherit behaviors and features from more than one 


Simple Single_Inheritance Graph

No comments:

Post a Comment