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
officer say me - i am offered to a smoking , then what can you say
What is multilevel inheritance in oop?
Can we override main method?
Why do we need polymorphism in c#?
Write a c++ program to display pass and fail for three student using static member function
Why do pointers exist?
What is this pointer in oop?
Is data hiding and abstraction same?
hi all..i want to know oops concepts clearly can any1 explain??
Why it is called runtime polymorphism?
Explain virtual inheritance?
How is polymorphism achieved?
What is pure oop?
What is abstraction in oop with example?
What is the types of inheritance?