what is multi level inheritance give n example ?

Answer Posted / itishree

A class is derive from a class which is derive from another
class is known as multilevel inheritance.
example-grandpa->papa->son
another example:
class A
{
protected:
int x;
public:
void showA()
{
cout<<"enter a value for x:"<<endl;
cin>>x;
}
};
class B:public A
{
protected:
int y;
public:
void showB()
{
cout<<"enter value for y:";
cin>>y;
}
};
class C:public B
{
public:
void showC()
{
showA();
showB();
cout<<"x*y ="<<x*y;
}
};
void main()
{
C ob1;
ob1.showc();
}

Is This Answer Correct ?    256 Yes 36 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Will I be able to get a picture in D drive to the c++ program? If so, help me out?

1652


How do you achieve runtime polymorphism?

569


What is object in oops?

612


What makes a language oop?

593


Which is better struts or spring?

616






What does and I oop and sksksk mean?

649


What is cohesion in oop?

620


What is stream in oop?

837


what type of questions

1695


IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?

1576


What is the purpose of polymorphism?

675


What is the advantage of oop over procedural language?

623


• What are the desirable attributes for memory managment?

1725


What is overriding in oop?

548


How is polymorphism achieved?

583