POV-Ray : Newsgroups : povray.off-topic : Lots of statistics : Re: C# Server Time
29 Jul 2024 06:15:42 EDT (-0400)
  Re: C#  
From: clipka
Date: 13 Aug 2012 16:22:41
Message: <50296211$1@news.povray.org>
Am 13.08.2012 18:22, schrieb Orchid Win7 v1:

>> I have never quite understood the reason why C++ and Eiffel seem to be
>> the only programming languages in existence that support multiple
>> inheritance, while the rest of OO languages only support a highly
>> crippled version of it.
>
> I have to admit, Eiffel /does/ make the solution look very, very
> complicated. (I can't actually remember off-hand how the heck C++ does
> it...)
>
>> And it's not like diamond inheritance is forbidden with interfaces
>> (AFAIK,
>> although I haven't checked this.)
>
> If interfaces aren't allowed to inherit anything, then a diamond is
> impossible.
>
> Weirdly, both Java and C# actually /allow/ interfaces to inherit, thus
> defeating the whole point of the exercise.
>
> My conclusion: WTF?

I suspect it's because if you restrict multiple inheritance to classes 
without data members (which is essentially what interfaces are), you can 
keep inherited classes' data structure layout fully compatible with 
their parents' without additional overhead.

Otherwise, I suspect you'd need some indirection similar to a virtual 
method table for the data as well - a virtual data member table, so to 
speak.

As current widespread belief is that virtually all multiple inheritance 
use cases can be covered with the interface approach, it seems to make 
sense to avoid this extra overhead.


Post a reply to this message

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