Geeks With Blogs

News Disclaimer
The views expressed on this weblog are mine and do not necessarily reflect the views of my employer.

All postings are provided "AS IS" with no warranties, and confer no rights.

Jignesh Gangajaliya's blog on Software Architecture and Development
I have heard many times that, multiple inheritance is supported in C# through interfaces hence thought of this post.

Let’s first have a re-look at what inheritance is. In object oriented programming, inheritance is a way to form new classes using classes that have already been defined. Inheritance promotes code reusability in design as the derived class inherits state and behavior from parent class.

When a class inherits from an interface it simply inherits method definitions for which it will provide implementation. Since interface doesn’t have any implementation, the question of code reusability doesn’t arise.

You're not achieving multiple inheritance simply by implementing an interface.
There are some tricks available to achieve the same behavior. E.g. Object Composition, however it is not true multiple inheritance.

- Jignesh
Posted on Thursday, June 25, 2009 7:35 PM Design | Back to top

Comments on this post: Is it really possible to achieve multiple inheritance in C# using interfaces? Is it called multiple inheritance when a class implements multiple interfaces?

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Jignesh Gangajaliya | Powered by: