21 April 2016

What is Inheritance in OOP(Object Oriented Programming) ?


  • Inheritance is the process by which one object can acquire the properties of another object.
  • In reality as Children get properties from Parents. Similarly in OOP(Object Oriented Programming) using inheritance a Child class can extends the data and member from its parent class.
  • There are various types of inheritance, based on paradigm and specific language.
Inheritance



  1. Single inheritance : Where subclasses inherit the features of one super class. A class acquires the properties of another class.  
    Single Inheritance
  2. Multiple inheritance: Where one class can have more than one super class and inherit features from all parent classes. 
    Multiple Inheritance
  3. Multilevel inheritance : Where a subclass is inherited from another subclass. Hierarchical inheritance: Where one class serves as a superclass (base class) for more than one sub class. 
    Multilevel Inheritance
  4. Hybrid inheritance: a mix of two or more of the above types of inheritance.

Object-Oriented Programming in C++ (4th Edition)
Object-Oriented Programming for Dummies

No comments:

Post a Comment

Featured Post

How to Write PHP code and HTML code within a same file

A PHP file can have both PHP code and HTML code together. Any HTML code written outside of PHP <?php //php code here… ?> Code is ig...

Popular Posts