Skip to main content
Engineering LibreTexts

1.7: OOP Inheritance

  • Page ID
    34639
  • The capability of a class to derive properties and characteristics from another class is called Inheritance. Inheritance is one of the most important features 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.
    • Reusability: Inheritance supports the concept of “reusability”, i.e. when we want to create a new class and there is already a class that includes some of the code that we want, we can derive our new class from the existing class. By doing this, we are reusing the fields and methods of the existing class.

    Example: Dog, Cat, Cow can be Derived Class of Animal Base Class.

    Adapted from:
    "Object Oriented Programming in C++" by Vankayala Karunakar., Geeks for Geeks is licensed under CC BY 4.0