1

It's always said that using interfaces we can achieve multiple inheritance in .NET.

While posting this question I also went this Are interfaces redundant with multiple inheritance?.

So far in my Development experience I haven't used interface to achieve multiple inheritance OR the need for that didn't arise.

Now my question is, is there any example for multiple inheritance in .NET frameworks or any popular libraries in .NET world.

Thanks

2 Answers 2

2

It's always said that using interfaces we can achieve multiple inheritance in .NET.

This is actually not true. There is no true multiple inheritance in .NET. Interfaces merely provide a mechanism to accomplish many of the same goals as multiple inheritance, with far fewer corner cases that cause problems.

Now my question is, is there any example for multiple inheritance in .NET frameworks or any popular libraries in .NET world.

Again - there is no multiple inheritance in .NET. Interfaces are used throughout the framework to provide reuse without having to specify a fixed base type, however. LINQ is a great example - nearly all of the functionality provided by LINQ works against interfaces, which allows that functionality to work across multiple types, without requiring multiple inheritance.

Sign up to request clarification or add additional context in comments.

1 Comment

Don't you mean "not" true?
-1
class MyBaseClass:IEnumerable,IQueryable

As you would already know the above is one of the prime examples of multiple inheritance in c# achieved thru interfaces.

StackOverflow discusses the topic in abundance for serious programmers like u..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.