POV-Ray : Newsgroups : povray.off-topic : And today, C# : Re: And today, C# Server Time
11 Oct 2024 03:14:52 EDT (-0400)
  Re: And today, C#  
From: Mike Raiford
Date: 12 Feb 2008 12:24:09
Message: <47b1d639$1@news.povray.org>
Warp wrote:
> 
>   Usually these managers and their widgets can be kept separate, but in
> this one case I needed to be able to gave the same objects to both
> managers.
> 
>   Without multiple inheritance this would have been simply impossible.
> I can't think of any way to accomplish this if multiple inheritance was
> not supported. With C++'s multiple inheritance it worked beautifully.
> I could create objects which were of both widget types at the same time,
> and which could be given to both widget managers without even the
> slightest of problems.
> 
>   I just can't even begin to imagine how I could have done this eg. in
> Java. (At least not without crippling the system really badly and making
> it really cumbersome to use.)

It has its uses. There's no clean way to handle this situation in C# or 
Java.


> 
>   Just avoid diamond inheritance if you are unsure. It's not that hard.
> 
>   Being able to inherit from two (completely distinct) classes is extremely
> handy regardless.
> 

Only one problem with that: in both C# and Java, all classes have a 
common base. So, with multiple inheritance, diamonds are a given. Rather 
than address this, they chose to not allow multiple inheritance. I'm 
guessing Java has interfaces, like C#.

> 
>   I don't like languages which artificially limit what I can do just
> because the creators feared diamond inheritance.
> 

Not completely artificial. They made a design decision with the 
language, which could potentially create problems later.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.