Explain different types of inheritance.

Technology CommunityCategory: OOPExplain different types of inheritance.
VietMX Staff asked 3 years ago

Inheritance in OOP is of four types:

  • Single inheritance – Contains one base class and one derived class
  • Hierarchical inheritance – Contains one base class and multiple derived classes of the same base class
  • Multilevel inheritance – Contains a class derived from a derived class
  • Multiple inheritance – Contains several base classes and a derived class

All .NET languages supports single, hierarchical, and multilevel inheritance. They do not support multiple inheritance because in these languages, a derived class cannot have more than one base class. However, you can implement multiple inheritance in.NET through interfaces.