Inheritance and Its Types

C++ is rich in its data types. Inheritance is the concept to inherit the properties of one class to another class. This has also known as class structure again. For example, classes A contains two-member function ads and subtracts and class b contain two another functions multiply and divide.

Inheritance is the concept to inherit the properties of one class to another class. This has also known as class structure again. For example, classes A contains two-member function ads and subtracts and class b contain two another functions multiply and divide. We want to use all these function with one object then we need to use inheritance where class B inherits all the property of class, which is public, but class B cannot use the private properties of class A. There are following types of inheritance:

1. Single class Inheritance:

When class a gas inherited in class has known as base class and B class is know as derived class. Here only two classes have linked to each other.

2. Multilevel Inheritance:

In this type of inheritance, there are number of level and it has used in that cases where we want to use all properties in number of levels according to the requirement. For example, class A inherited in class b and class b has inherited in class c for class b so on. Where class A is base class c. In another way we can say b is derived class a base class for c and a indirect base class for c is indirect base class for c and c indirect derived class for class A.

3. Multiple Inheritances:

In this type of inheritance, number of classes has inherited in a single class. Where two or more classes are, know as base class and one is derive class.

4. Hierarchical Inheritance:

This type of inheritance helps us to create a baseless for number of classes and those numbers of classes can have further their branches of number of class.

5. Hybrid Inheritance:

In this type of inheritance, we can have mixture of number of inheritances but this can generate an error of using same name function from no of classes, which will bother the compiler to how to use the functions. Therefore, it will generate errors in the program. This has known as ambiguity or duplicity.

91
Liked it
44 Responses to “Inheritance and Its Types”
  1. Jenny Heart Says...

    On August 15, 2009 at 2:15 pm

    Well written! Like it!


  2. joey111 Says...

    On August 15, 2009 at 2:53 pm

    great article


  3. codfish Says...

    On August 15, 2009 at 7:28 pm

    realy good artical


  4. James Reynolds Says...

    On August 15, 2009 at 11:02 pm

    thats a good article. keep it up


  5. Casual observer Says...

    On August 16, 2009 at 4:54 am

    Great work!


  6. giftarist Says...

    On August 16, 2009 at 4:58 am

    Very informative article

    Thanks


  7. Ashley89 Says...

    On August 17, 2009 at 12:27 pm

    Bringing stucture and understanding!!!! Nice job!


  8. Michal Dorcak Says...

    On August 18, 2009 at 6:50 am

    Great article. Keep the good work comming.


  9. mystery61 Says...

    On August 19, 2009 at 1:27 am

    Great article. Keep writing!


  10. mindopener Says...

    On August 20, 2009 at 7:19 am

    Nice and explanitory! I like your graphs and charts to help visually understand the concepts.


  11. Jamie Myles Says...

    On August 22, 2009 at 12:06 am

    Quite interesting. well done


  12. Amandeep Says...

    On August 22, 2009 at 11:41 am

    Good Stuff
    I want to become your student.


  13. Jacques Berkeley Says...

    On August 25, 2009 at 12:10 pm

    C++ is popular. This article will help anyone who wants to learn it.


  14. Mike Says...

    On August 26, 2009 at 12:31 am

    Thanks for the information..very useful


  15. emmy19 Says...

    On September 10, 2009 at 6:49 am

    Good Work

    Informative

    Best Wishes


  16. abhishek Says...

    On November 28, 2009 at 5:46 am

    f9.. but one type missing.
    which is MULTIPATH INHERITANCE,


  17. Sanjay Says...

    On December 5, 2009 at 1:31 am

    A nice one, but plz make it easy with giving different examples for each, Afterall Fantastic…..


  18. Narendra Says...

    On February 8, 2010 at 8:32 am

    It is nice ,but should improve it diagramatically mor clear


  19. gaurav Says...

    On February 19, 2010 at 3:51 am

    nice work……………thanks a lot


  20. naveen Says...

    On February 19, 2010 at 11:47 pm

    this is good ….defination
    of inheritence……….i like it


  21. SAMBHAJI Says...

    On April 9, 2010 at 11:05 am

    EXCELENT INFORMATION.
    I WILL AGRY WITH YOUR DEFINATION.
    THIS EXPLANATION INCREASE THE KNOLEDGE


  22. ANUPAM DUTTA Says...

    On April 26, 2010 at 11:08 pm

    THANKS , A GOOD DEFINATION OF INHERITANCE.


  23. Sarang Says...

    On May 6, 2010 at 2:18 pm

    Good explanation………..


  24. Fawad satti Says...

    On May 10, 2010 at 1:15 pm

    thats awesome


  25. kritika rana Says...

    On June 7, 2010 at 11:50 am

    thats nice explanation………………briliant


  26. mani(patty) Says...

    On June 24, 2010 at 8:05 am

    very good explanation


  27. akash Says...

    On September 30, 2010 at 10:54 am

    in is nice but u r tell me that hoe is working


  28. akash Says...

    On September 30, 2010 at 10:56 am

    it is nice but u r tell me that how it working??????????????plz give me ans fast


  29. sohail riaz virk Says...

    On October 3, 2010 at 3:17 am

    really its amazing


  30. Krishna Says...

    On October 9, 2010 at 1:21 pm

    excuse guys i want types and their flow chart. The above displayed are not the real explainations


  31. Inderjeet nJuneja Says...

    On October 19, 2010 at 5:51 am

    It is oweseme


  32. rishabh Says...

    On October 28, 2010 at 3:22 am

    great article


  33. pawan rohini mishra Says...

    On December 3, 2010 at 12:15 am

    thanks for this article
    .very easy to understand..


  34. dipen Says...

    On December 13, 2010 at 7:52 am

    good one


  35. ganesh Says...

    On February 9, 2011 at 10:05 am

    nice presentation…..thankxxxx


  36. Socrates Says...

    On March 18, 2011 at 1:23 am

    Is it me or this crappy english made it hard to understand ?


  37. suraj Says...

    On June 5, 2011 at 11:13 am

    gud one is that it is very help full for the other students and good explain every point


  38. Amit Says...

    On June 22, 2011 at 1:01 pm

    thnks….4 nice article


  39. aman jain Says...

    On June 26, 2011 at 4:41 am

    thanks for the definations………plz also provide programes for the definations…


  40. bharti Says...

    On August 7, 2011 at 4:33 am

    can do more better


  41. anandanu Says...

    On August 23, 2011 at 7:19 am

    this example is not much more.we want more explanation.please…………………….


  42. Deepak Says...

    On December 12, 2011 at 10:38 pm

    helpfull


  43. felix kimeu Says...

    On March 1, 2012 at 9:01 am

    a nice article congrats.keep it up


  44. shashank singh Says...

    On December 12, 2012 at 1:26 pm

    thanks for the definations………plz also provide programes for the definations…


Post Comment
comments powered by Disqus