Old problem with performance

Christopher Wright dhasenan at gmail.com
Mon Feb 9 04:35:38 PST 2009


Rainer Deyke wrote:
> Andrei Alexandrescu wrote:
>> The slicing problem exists in spades in this example, or better put its
>> converse (your code will fire asserts when it shouldn't). The reason is
>> rather subtle, so please try the code out to edify yourself.
> 
> You're referring to the automatically generated copy constructor in
> class 'avatar' which calls the copy constructor in class 'person',
> right?  That's a bug in my silly untested example code, but it's not the
> slicing problem.

It's also a problem whenever you use avatar by value. It's only by 
programmer discipline that you avoid the slicing problem.



More information about the Digitalmars-d mailing list