Results 1 to 4 of 4

Thread: What is the difference between Single inheritance and multilevel inheritance?

  1. #1
    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.

  2. #2
    Join Date
    Apr 2009
    Posts
    570

    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. #3
    Join Date
    Apr 2009
    Posts
    491

    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.

  4. #4
    Join Date
    May 2009
    Posts
    527

    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.

Similar Threads

  1. Disadvantages of Inheritance
    By Bottlenecked in forum Software Development
    Replies: 5
    Last Post: 10-02-2010, 07:18 AM
  2. What is an Inheritance in C#?
    By - Empty Shell - in forum Software Development
    Replies: 4
    Last Post: 09-02-2010, 06:03 AM
  3. What are the advantages of Inheritance?
    By ScarFace 01 in forum Software Development
    Replies: 5
    Last Post: 01-02-2010, 11:28 AM
  4. Polymorphism VS Inheritance
    By Taylor D in forum Software Development
    Replies: 5
    Last Post: 22-01-2010, 09:12 AM
  5. Genericity and Inheritance
    By Ricky58 in forum Software Development
    Replies: 4
    Last Post: 30-10-2009, 11:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •