what was wrong with struct & class in C++?

Walter Bright newshound1 at digitalmars.com
Sat Dec 15 15:38:49 PST 2007


Christopher Wright wrote:
> That would be allowed in D, if you could overload T.opAssign(T).

C++ still has well-known slicing problems, even with overloading assignment.

The question is not "can this be done", it's more "is there a compelling 
reason to support such behavior". I think the answer is no. Do you 
really want a language where a class designer feels compelled to define 
an opassign overload, then make it private to prevent people from using 
the class as a value type? Where the base class designer needs to know 
what the derived classes are doing so he can make the destructor virtual 
or not? Where you cannot have arrays of base classes?



More information about the Digitalmars-d mailing list