Re: Why not multiple inheritance in C# and java

Tech-Archive recommends: Fix windows errors by optimizing your registry



That would be fantastic!

One of my bug-bears with C# is that there is no way to provide a stock
implementation of an interface. ATL makes great use of that ability with the
I*Impl templates, and it would be great to be able to do a similar thing in
C#.

Sure, it isn't absolutely necessary, but the alternative is the old
cut-and-paste methodology which I despise.

Aaron.

"cody" wrote:

> There is a proposal from Anders Hejlsberg to add support for a default
> implementation to interfaces to C#, this is something like a limited support
> for MI but sounds useful.
>
>
> "Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> schrieb im Newsbeitrag
> news:MPG.1d2c4cc3f2bbb41d98c3d8@xxxxxxxxxxxxxxxxxxxxxxx
> > MAHESH MANDHARE <mahesh_dotnetinfo@xxxxxxxxxxx> wrote:
> > > Can Anyone explain me exactly why multiple inheritance not used in java
> and c#
> >
> > Basically because they introduce additional complexity into the
> > language which can then mean additional complexity in the code (whether
> > it means the code being more obviously complicated, or just harder to
> > understand at a glance).
> >
> > It was also considered that multiple inheritance of implementation is
> > rarely very beneficial. Note that there is still multiple inheritance
> > of interface in both .NET and Java.
> >
> > Never having used multiple inheritance of implementation myself, I
> > can't comment on how much of a loss it is, but I can't say I've often
> > thought "ooh, I wish I could derive from both of these classes" in my
> > code.
> >
> > --
> > Jon Skeet - <skeet@xxxxxxxxx>
> > http://www.pobox.com/~skeet
> > If replying to the group, please do not mail me too
>
>
>
.



Relevant Pages

  • Re: Multiple Inheritance In Java
    ... > cause multiple objects of Object to exist in the code which could be ... There are other approaches to multiple inheritance that don't use the C++ ... suspect that if Java had been defined to have MI, then the ... Java-like language that only allowed interface names to be ...
    (comp.lang.java.programmer)
  • Re: "Must instantiate controlled types at library level." Why?
    ... You will have this for free with multiple inheritance. ... You cannot have objects of an abstract type (interface). ... Is it impossible to have a generic function that operates on ... we could create such supertypes as necessary *afterwards*. ...
    (comp.lang.ada)
  • Re: Multiple Inheritance
    ... Then, to me, it can be read "Multiple inheritance, as done in C++, ... was discarded from Java". ... that multiple interface inheritance is not multiple inheritance. ... showed that your quoting of "Gosling" (if he really did write ...
    (comp.lang.java.programmer)
  • Re: Multiple inheritance examples?
    ... Java programmers actually use multiple inheritance more often than they are aware of. ... Basically, there is an idiom which is used in the Swing framework, but also elsewhere, where an API is presented in three entities: An interface that defines the API as such, an abstract class implementing that interface which provides template methods for easy subclassing, and a default implementation derived from that abstract class that can just be instantiated to get the behavior you 'usually' want. ... This largely doesn't exist in CLOS. ...
    (comp.lang.lisp)
  • !Re: Why cant C# or Java support multiple inheritance? But inherit multiple interfaces instead??
    ... that's what the Java folks did. ... Inspiration for the Interface ... In Java you included multiple inheritance of interface, ...
    (comp.object)