Inheritance in C++ with Example.
Inheritance in C++ is basically the capability of one class to inherit properties from another class . For example , house is a class wherefrom class chiarhouse inherits as given below:
class house
{
protected:
char name[25];
int rollno;
public:
void readhouse ();
void showhouse ();
};
class chairhouse: protected house
{
protected :
char tables[50];
public:
void readchahou();
void showchahou();
};
No comments:
Post a Comment