Inheritance In C++

This thread contains 3 replies, has 4 voices, and was last updated by  Bhasker Nimi 3 months, 2 weeks ago.

  • Author Replies
  • #55611

    How Many Types of Inheritance Are There In C++ Programming Language?

  • #55613

    There are 5 types of Inheritance in C++.

    1) Single Inheritance
    2) Multiple Inheritance
    3) Hierarchical Inheritance
    4) Multilevel Inheritance
    5) Hybrid Inheritance (also known as Virtual Inheritance)

    Nitesh Bavishiya

  • #58190

    The capability of a class to derive properties and characteristics from another class is called Inheritance. Inheritance is one of the most important feature of Object Oriented Programming.
    Sub Class: The class that inherits properties from another class is called Sub class or Derived Class.
    Super Class:The class whose properties are inherited by sub class is called Base Class or Super class.

    // C++ program to demonstrate implementation
    // of Inheritance

    #include <bits/stdc++.h>
    using namespace std;

    //Base class
    class Parent
    int id_p;

    // Sub class inheriting from Base Class(Parent)
    class Child : public Parent
    int id_c;

    //main function
    int main()

    Child obj1;

    // An object of class child has all data members
    // and member functions of class parent
    obj1.id_c = 7;
    obj1.id_p = 91;
    cout << “Child id is ” << obj1.id_c << endl;
    cout << “Parent id is ” << obj1.id_p << endl;

    return 0;

    Child id is 7
    Parent id is 91

    To know more about this visit at:

  • #58664

    c is a basic programing language. this is help to us to read any language

    Attachments (Allowed file type: .jpg, .jpeg, .png, .pdf):
    You must be logged in to view attached files.

You must be to reply to this thread.Please or . Registration is 100% free.


Call Us Now For Free Consultation97370 05566

Our experts listen to you patiently and suggest you the right course after conducting a personality profile test. Register your interest below to schedule personality profile test for you.


Contact Us

Working Hours

  • Monday9:00 AM – 9:00 PM
  • Tuesday9:00 AM – 9:00 PM
  • Wednesday9:00 AM – 9:00 PM
  • Thursday9:00 AM – 9:00 PM
  • Friday9:00 AM – 9:00 PM
  • Saturday9:00 AM – 9:00 PM
  • SundayClosed
Copyright 2016-2019 Smart Mentors. All Rights Reserved.



Sign up now to Become An Instructor

Register your Interest