POV-Ray : Newsgroups : povray.off-topic : Lots of statistics : Re: C# Server Time
29 Jul 2024 06:13:33 EDT (-0400)
  Re: C#  
From: Le Forgeron
Date: 13 Aug 2012 14:56:22
Message: <50294dd6$1@news.povray.org>
Le 13/08/2012 19:26, Warp nous fit lire :
> Orchid Win7 v1 <voi### [at] devnull> wrote:
>>> 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...)
> 
> Does what?

Manage inheritances, including multiple inheritances.

> 
>> I would have thought the indirect code jump is probably far more 
>> expensive than the space overhead.
> 
> The additional space consumption is significant if you have eg. a class
> that would otherwise be the size of a pointer (and you need to instantiate
> millions of them). If you had forced virtual functions, it would double in
> size.

IIRC, C++ does not duplicates the class function members (not even
pointers to them) in each instance. Only the actual class (as 1 pointer)
is stored within each instance. The virtual function is just an index.
The first virtual/inheritance cost a pointer in the class. The next are
free.(in fact, with RTTI, even without inheritance, you might already
have that pointer: so no additional cost)


Post a reply to this message

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