Net-informations.com

Different Types of Inheritance

Inheritance is the process of creating a new Class, called the Derived Class , from the existing class, called the Base Class . The Inheritance has many advantages, the most important of them being the reusability of code. Rather than developing new Objects from scratch, new code can be based on the work of other developers, adding only the new features that are needed. The reuse of existing classes saves time and effort.

However, inheritance may be implemented in different combinations in Object-Oriented Programming languages as illustrated in figure and they include:

  1. Single Inheritance
  2. Multi Level Inheritance
  3. Hierarchical Inheritance
  4. Hybrid Inheritance
  5. Multipath inheritance
  6. Multiple Inheritance

Single Inheritance


Single Inheritance in C# VB.Net

When a Derived Class to inherit properties and behavior from a single Base Class , it is called as single inheritance.

Multi Level Inheritance


Multi Level Inheritance in C# VB.Net

A derived class is created from another derived class is called Multi Level Inheritance .

Hierarchical Inheritance


Hierarchical Inheritance in C# VB.Net

More than one derived classes are created from a single base class, is called Hierarchical Inheritance .

Hybrid Inheritance


Hybrid Inheritance in C# VB.Net

Any combination of above three inheritance (single, hierarchical and multi level) is called as hybrid inheritance .

Multipath inheritance


Multipath inheritance in C# VB.Net

Multiple inheritance is a method of inheritance in which one derived class can inherit properties of base class in different paths. This inheritance is not supported in .NET Languages such as C#.

Multiple Inheritance


Multipath inheritance in C# VB.Net

Multiple inheritances allows programmers to create classes that combine aspects of multiple classes and their corresponding hierarchies. In .Net Framework, the classes are only allowed to inherit from a single parent class, which is called single inheritance. More about.... Why in .NET multiple inheritance is not allowed

Different types of inheritance in C#

  1. Single Inheritance
  2. Multilevel Inheritance
  3. Hierarchical Inheritance
  4. Multiple Inheritance (Through Interface)
  5. Hybrid Inheritance (Through Interface)

Multiple inheritance and Hybrid Inheritance are not supported in C# through class.

Different types of inheritance in c++

In C++ programming language , inheritance is a process in which one object acquires all the properties and behaviours of its parent object automatically. It allows user to create a Child Class (Derived Class) from an existing Parent Class (Base Class). To inherit from a class, C++ use the : symbol. C++ supports five types of inheritance:

  1. Single Inheritance
  2. Multiple Inheritance
  3. Multilevel Inheritance
  4. Hierarchical Inheritance
  5. Hybrid Inheritance

Different types of inheritance in Java

Object-Oriented Programming or better known as OOPs is one of the major pillars of Java that has leveraged its power and ease of usage. The extends keyword indicates that you are making a new class that derives from an existing class. The meaning of "extends" is to increase the functionality. Java supports five types of inheritance:

  1. Single Inheritance
  2. Multilevel Inheritance
  3. Hierarchical Inheritance
  4. Multiple Inheritance (Through Interface)
  5. Hybrid Inheritance (Through Interface)

Multiple inheritance and Hybrid Inheritance are not supported in Java through class.

Different types of inheritance in Python

Python Inheritance allows you to define a class that inherits all the methods and properties from another class. Like C++, a class can be derived from more than one base classes in Python. This is called multiple inheritance. Python supports five types of inheritance:

  1. Single Inheritance
  2. Multiple Inheritance
  3. Multilevel Inheritance
  4. Hierarchical Inheritance
  5. Hybrid Inheritance









net-informations.com (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About