Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



What is the difference between Single inheritance and multilevel inheritance?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 08-01-2011
Member
 
Join Date: Dec 2010
Posts: 12
What is the difference between Single inheritance and multilevel inheritance?
  

Hey guys, I want to know what is the difference between Single Inheritance and multilevel inheritance in C++. I am not aware of the term inheritance in C++. I am aware with concepts of C programming but I did not find term inheritance in C programming. This is completely new term for me. So if anybody having any clue or any information then please let me know so that I could understand this term and clear my concepts.

Reply With Quote
  #2  
Old 08-01-2011
Member
 
Join Date: Apr 2009
Posts: 566
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.
Reply With Quote
  #3  
Old 08-01-2011
Member
 
Join Date: Apr 2009
Posts: 479
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( );
                        }
In the above program class B inherites class A. so all the public variable and function of class A will be inherited by class B. so the variable and function declared as public or protected will be available to class B.
Reply With Quote
  #4  
Old 08-01-2011
Member
 
Join Date: May 2009
Posts: 523
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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 are the advantages of Inheritance? ScarFace 01 Software Development 5 01-02-2010 11:28 AM
Polymorphism VS Inheritance Taylor D Software Development 5 22-01-2010 09:12 AM
Genericity and Inheritance Ricky58 Software Development 4 30-10-2009 11:41 PM


All times are GMT +5.5. The time now is 10:55 AM.