Can we use multiple inheritances in .NET

Can we use multiple inheritances in .NET?




.NET supports only single inheritance. However the purpose is accomplished using multiple interfaces.



What is implementation and interface inheritance?


When a class (type) is derived from another class(type) such that it inherits all the members of the base type it is Implementation Inheritance.
When a type (class or a struct) inherits only the signatures of the functions from another type it is Interface Inheritance.
In general Classes can be derived from another class, hence support Implementation inheritance. At the same time Classes can also be derived from one or more interfaces. Hence they support Interface inheritance.
What is inheritance hierarchy?

The class which derives functionality from a base class is called a derived class. A derived class can also act as a base class for another class. Thus it is possible to create a tree-like structure that illustrates the relationship between all related classes. This structure is known as the inheritance hierarchy.
How do you prevent a class from being inherited?

In VB.NET you use the Not Inheritable modifier to prevent programmers from using the class as a base class. In C#, use the sealed keyword.

Welcome to this ASP.NET Tutorial, currently consisting of posts, these are covering all the most important ASP.NET concepts. This tutorial is primarily for new users of this great technology, and we recommend you to go through all the post, to get the most out of it as possible. While each post can be used without reading the previous posts, some of them may reference things done in earlier post.



Comments

Popular posts from this blog