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
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
How do you achieve runtime polymorphism?
What is object in oops?
What makes a language oop?
Which is better struts or spring?
What does and I oop and sksksk mean?
What is cohesion in oop?
What is stream in oop?
what type of questions
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?
What is the purpose of polymorphism?
What is the advantage of oop over procedural language?
• What are the desirable attributes for memory managment?
What is overriding in oop?
How is polymorphism achieved?