1.

Illustrate the concept of Inheritance with the help of an example.

Answer»

Inheritance is the capability of one class to inherit properties from another class. For instance, Student is a class wherefrom class GraduateStudent inherits as given below:

class Student

{

protected:

char name[25];

int rollno;

public:

void readStudent();

void showStudent();

};

class GraduateStudent:protected Student

{

protected:

char subjects[50];

public:

void readAradStud();

void showGradStud();

};



Discussion

No Comment Found

Related InterviewSolutions