Learning Curve…

Types of Inheritance in C#.NET

Posted on: November 8, 2011

Creating a new class from existing class is called as inheritance.
Inheritance can be classified to 5 types.

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

1. Single Inheritance

when a single derived class is created from a single base class then the inheritance is called as single inheritance.

Single level Inheritance

2. Hierarchical Inheritance

when more than one derived class are created from a single base class, then that inheritance is called as hierarchical inheritance.

Hierarical Inheritance

3. Multi Level Inheritance

when a derived class is created from another derived class, then that inheritance is called as multi level inheritance.

Multi level Inheritance

4. Hybrid Inheritance

Any combination of single, hierarchical and multi level inheritances is called as hybrid inheritance.

Hybrid inheritance in C#

5. Multiple Inheritance

when a derived class is created from more than one base class then that inheritance is called as multiple inheritance. But multiple inheritance is not supported by .net using classes and can be done using interfaces.

Multiple inheritance in C#

Handling the complexity that causes due to multiple inheritance is very complex. Hence it was not supported in dotnet with class and it can be done with interfaces.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Author

Learning days (Calendar)

November 2011
M T W T F S S
« Oct   Dec »
 123456
78910111213
14151617181920
21222324252627
282930  

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 507,854 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43 other followers

%d bloggers like this: