473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Why C# doesnt support Multiple inheritance

Hi...
i need the solution of Why C# doesnt support Multiple inheritance????
Let me know the solution plz..
Thanks&Regards,
Bremanand.S
Jul 24 '06 #1
9 14726
axas
32
You have to use Intefaces for supporting multiple inheritance.
The reason is that is a better programming technique.
Jul 24 '06 #2
dotnet
22
Not just C#, infact complete CLR doesn't support mutiple inheritence. However you can achieve your functionality using interfaces.

There are several reasons for multiple inheritence in not introduced in CLR.
First and foremost, .net allows you to use mutiple languages and each of these language would behave differently on how multiple inheritence works over it. So it was difficult for designers to resolve this issue.
Also mutiple inheritence create lot of complexity in the code.

for more read http://blogs.msdn.com/csharpfaq/arch.../07/85562.aspx
Jul 28 '06 #3
fiatnm
4
A child cannot have many parents. Multiple inheritence is assuming that a child can have many parents which is impossible that is way C# doesn't suppport multiple inheritence.
Mar 6 '07 #4
A child cannot have many parents. Multiple inheritence is assuming that a child can have many parents which is impossible that is way C# doesn't suppport multiple inheritence.
:Deleted:

Your response was not constructive. Please refrain from being a jerk. If you would like to restate your point in a polite and concise manner you can reply to this post.

-MODERATOR
Oct 18 '07 #5
Plater
7,872 Expert 4TB
What language DOES support multiple inheritance?
Java doesn't.
None of the .net stuff does.

I think mozart/oz does, but that language is crazy.



Also, picking on someone for their terrible argument then making an equally terrible statement is kind of defeating. Unless that was the point and I missed it.
Oct 18 '07 #6
RedSon
5,000 Expert 4TB
A child cannot have many parents. Multiple inheritence is assuming that a child can have many parents which is impossible that is way C# doesn't suppport multiple inheritence.
This is incorrect. A child class can have many parents if it aggregates the functionality of those parent classes.

Consider a real life example, amphibious vehicles are able to traverse both land and sea. Therefore in a programming environment it would make sense for them to inherit from both "car" and "boat" classes.
Oct 18 '07 #7
Axas and dotnet are right, just imagine the mess it would be with multiple inheritance.

in my opinion, it just makes no sense. During all the time ived been developing in c++, never have i used multiple inheritance. why? Because the maintenance of the code is a lot more difficult, understanding the code is harder, and whole lot of programming difficulties it implies, and the most important reason, i just never encountered any real need to use it, besides if you ever search up multiple inheritance in c++, theres is no real example that proves it useful.

Then i started developing java apps and found that interfaces where alot more practical and useful, because you can multiply inherit the interface, but not the imlementation, wich was up to the client class. wich simply does make sense,
code looks clean and understandable.

So as a conclusion. I think creators of c#, really made a noticable upgrade to c++, added some stuff that came along with java that simply seemed useful(and other new stuff that .net implies being .net language) and voila, resulted in c#
Oct 18 '07 #8
A child cannot have many parents. Multiple inheritence is assuming that a child can have many parents which is impossible that is way C# doesn't suppport multiple inheritence.

in c++ multiple inheritance is support, then why not in c#?
Mar 18 '08 #9
RedSon
5,000 Expert 4TB
Here is the truth, straight from the horse's mouth...

http://blogs.msdn.com/csharpfaq/arch.../07/85562.aspx
Mar 18 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
5
by: Morgan Cheng | last post by:
It seems no pattern defined by GoF takes advantage of multiple inheritance. I am wondering if there is a situation where multiple inheritance is a necessary solution. When coding in C++, should...
20
by: km | last post by:
Hi all, In the following code why am i not able to access class A's object attribute - 'a' ? I wishto extent class D with all the attributes of its base classes. how do i do that ? thanks in...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
1
by: vinoraja | last post by:
There are a number of reasons we don't implement Multiple Implementation Inheritance directly. (As you know, we support Multiple Interface Inheritance). However, I should point out that it's...
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
7
by: Adam Nielsen | last post by:
Hi everyone, I'm having some trouble getting the correct chain of constructors to be called when creating an object at the bottom of a hierarchy. Have a look at the code below - the inheritance...
4
by: Mukesh_Singh_Nick | last post by:
Does PHP support multiple inheritence? If not, how would one workaround it when one needs a class to inherit from multiple classes?
2
by: Paul McGuire | last post by:
On May 25, 8:37 am, Michael Hines <michael.hi...@yale.eduwrote: Here's a more general version of your testing code, to detect *any* diamond multiple inheritance (using your sample classes). --...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.