196

Multiple Inheritance in C#

Share on TwitterShare on TumblrSubmit to StumbleUponSave on DeliciousDigg This

This article shows how multiple inheritance can be effected by the use of interface.

Download

 Download source code for Multiple Inheritance in C#

 

 

Introduction

In C# Multiple Inheritance can be effected using Interface. We can implement multiple interfaces. But we cannot inherit multiple Base Classes.

Single Class inheritance

Output

A Class cannot have multiple Base Classes

Here intellisense is also not providing the method name of the class B. Thus restricting multiple inheritance using more than one class.

Error Message

Multiple Interfaces can be implemented

Here multiple interfaces can be used using comma(,). Thus allowing multiple inheritance, by implementing more than interface.

Output

Hope this article will be useful.

Thanks!

prajapat