|
| ||||||||||
| Tags: class, inheritance, multilevel inheritance, object oriented, single inheritance |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| What is the difference between Single inheritance and multilevel inheritance?
|
|
#2
| |||
| |||
| Re: What is the difference between Single inheritance and multilevel inheritance?
Inheritance was defined as deriving a new class from the exiting base class. When only one class is derived from a single base class, the type of inheritance is called as single inheritance .A class which is inhering is known as derived class where as the class which is being inherited is called base class. In inheritance the properties of one class is inherited by other class. The class A is Base class and class B is the derived class. Let’s consider that we have class vehicle which is inherited by class taxi. |
|
#3
| |||
| |||
| Re: What is the difference between Single inheritance and multilevel inheritance? Code: For ex :-
class A
{
public : int k;
public : void show ( )
{
cout < <k;
}
} ;
class B: public A
{
int j;
public : void disp ( )
{
cout << j <<” “<<k ;
}
} ;
main ( )
{
B Ob ;
Ob. show( );
Ob.disp( );
} |
|
#4
| ||||
| ||||
| Re: What is the difference between Single inheritance and multilevel inheritance?
When one class is inherited from other class which itself is inherited by other .Then such type of inheritance is known as multilevel inheritance. Means one class is base which has one derived class, and the derived class acts as base class for other and deriving some class. For EX: - class A is inherited by the class B and class B is inherited by class C. such kind of inheritance is known as multilevel inheritance. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "What is the difference between Single inheritance and multilevel inheritance?" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Disadvantages of Inheritance | Bottlenecked | Software Development | 5 | 10-02-2010 07:18 AM |
| What is an Inheritance in C#? | - Empty Shell - | Software Development | 4 | 09-02-2010 06:03 AM |
| What does Inheritance mean in java? | Mithun Seth | Software Development | 5 | 08-02-2010 10:45 AM |
| What are the different types of Inheritance in C++? | Techno Guru | Software Development | 5 | 27-01-2010 12:37 PM |
| Genericity and Inheritance | Ricky58 | Software Development | 4 | 30-10-2009 11:41 PM |