Computer Science, asked by nishi4844, 1 year ago

Example for declaration of base class and subclass and how subclass inherit base class

Answers

Answered by deekshaDixit5
0

Answer:

class parent

{

int i;

public :

void display()

{

cout<<"inheritance";

}

};

class child : public parent

{ int j;

};

main()

{

child c1;

c1.display();

}

object of class child will use the member function of class parent

it mean inheritance is demonstrated.

Similar questions
Math, 6 months ago