WHy C#net doesnot support Mul.inheritance?
-
Why C#.net does not support multiple inheritance?why it can support by interface?why not by class?
Because the designers decided they'd cripple the language in the interests of making it "safer". X| Implementing an interface is unrelated to inheritence.
-
Why C#.net does not support multiple inheritance?why it can support by interface?why not by class?
C# and Java languages don't support multiple inheritance because of the diamond problem[^]. Here is the short summary:
The diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C?
Uri
-
C# and Java languages don't support multiple inheritance because of the diamond problem[^]. Here is the short summary:
The diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C?
Uri
This is a stupid example, given by people too stupid to understand the value of multiple inheritance. It seems the C# team is in general too stupid to understand complex solutions, I asked them for default parameter values years ago, and they got very confused trying to work out how that would work, or why you'd use it. The example is valid, but it assumes the programmer is a moron. A good language assumes it will be used well, not protects itself from being used poorly
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
This is a stupid example, given by people too stupid to understand the value of multiple inheritance. It seems the C# team is in general too stupid to understand complex solutions, I asked them for default parameter values years ago, and they got very confused trying to work out how that would work, or why you'd use it. The example is valid, but it assumes the programmer is a moron. A good language assumes it will be used well, not protects itself from being used poorly
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Hear hear! I think that's what I said. :-D
Christian Graus wrote:
default parameter values
Aren't those in C# 4.0 ?
-
Hear hear! I think that's what I said. :-D
Christian Graus wrote:
default parameter values
Aren't those in C# 4.0 ?
Yes, you did.
PIEBALDconsult wrote:
Aren't those in C# 4.0 ?
Yes, it's taken them three iterations to realise the people crying for it were right. And, they explicitly told me that if they have a choice between making the language powerful, or making it easy and safe, they choose the latter.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
C# and Java languages don't support multiple inheritance because of the diamond problem[^]. Here is the short summary:
The diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C?
Uri
That's no reason. Pointers are much more dangerous yet they're still available in C#. Why not allow multiple inheritence in an unsafe context? :-D
-
Why C#.net does not support multiple inheritance?why it can support by interface?why not by class?
Chris Brumme from the CLR team explain here[^] the reason.
Navaneeth How to use google | Ask smart questions
-
This is a stupid example, given by people too stupid to understand the value of multiple inheritance. It seems the C# team is in general too stupid to understand complex solutions, I asked them for default parameter values years ago, and they got very confused trying to work out how that would work, or why you'd use it. The example is valid, but it assumes the programmer is a moron. A good language assumes it will be used well, not protects itself from being used poorly
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Christian Graus wrote:
It seems the C# team is in general too stupid to understand complex solutions
Wow, that's quite an accusation. How many programming languages have you written, Christian? I'd think the main issue here is not language, but the CLR. If C# supports multiple inheritance, there must be some way to express it in metadata and IL, which means the CLR must support it. I'm guessing here that that would mean only a language which is aware of multiple inheritance would be able to deal with that type. Also, the way C++ implements MI might not be compatible with the CLR requirements (reflection etc..), so there are problems even for a language that already supports MI. In general, I'd say language changes that only affect code generation (lambdas, automatic properties) are much more simpler than those that change the type system (generics etc..).
Christian Graus wrote:
I asked them for default parameter values years ago, and they got very confused trying to work out
Unlike C++ which requires recompilation whenever a module changes, .NET supports binding against different versions of a module (assembly). Which means that embedding the default values at the caller will break versioning. I don't see how that assumes the programmer is a moron.
Regards Senthil _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro
-
Chris Brumme from the CLR team explain here[^] the reason.
Navaneeth How to use google | Ask smart questions
Ah, now that makes sense! I can certainly see how technical issues can inhibit implementation; I hope they really are trying to resolve them. P.S. And mixins sound like a good idea too.