Old problem with performance

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Feb 8 12:56:05 PST 2009


Rainer Deyke wrote:
> Michel Fortin wrote:
>> Polymorphism doesn't work very well while passing objects by value, even
>> in C++. This is called the slicing problem.
> 
> I have heard about the slicing problem.  I know what it is.  But in all
> my years of using C++ as my primary language, I have never actually
> encountered it.  I don't believe it actually exists.

How long have you used C++?

This is not a tendentious question. In the recent years, the advent of 
quality smart pointers, an increased scrutiny of use of inheritance, and 
the teaching of idioms associated with reference types has greatly 
diminished slicing accidents. But in the olden days, people were 
inheriting value types left and right because it was the emperor's new 
clothes.

Andrei



More information about the Digitalmars-d mailing list