06-06-2013, 04:14 PM
Interface: Multiple Inheritance
Interface Multiple.pptx (Size: 56.09 KB / Downloads: 18)
Introduction
C# does not support multiple inheritance
That is, classes in C# cannot have more than one superclass
Class A: B,C
Is not permitted in C#
A large number of real time application requires multiple inheritance
So C# provides an alternate approach known as interface to support the concept of multiple inheritance
An interface in C# is a reference type
It is basically a class with some difference and major difference are..
All the members of interface are implicitly public and abstract
An interface can not contain constant fields, constructors and Destructors
Its members can not be declare static
Since methods in interface are abstract, they do not include implementation code
An interface can inherit multiple interface
Extending an Interface
While interface are allowed to extend other interfaces, subinterfaces cannot defined the methods declared in superinterface
After all, subinterface are still interface, not class
It is the responsibility of the class that implements the derived interface to define all methods
It is important to not that an interface can not extend classes, this would violate the rule that an interface can have only abstract members