object oriented value type

Ender KaShae astrothayne at gmail.com
Mon Jun 25 09:06:37 PDT 2007


I find it a little disappointing that D does not have any support for the C++ way of object oriented value types, both c# and D have structs that pass by value but do not support inheritance and classes passed by reference that do support inheritance, D adds injury to insult by prohibiting hidden members in structs.  But what about when you need a type that passes by value and supports inheritance, I don't think that the structs necessarily need to be changed, rathe I think that a new type should be created as a combination of a struct and a class.  This would be particularly useful in inheriting from primitave types.  Another example is having a mixedFraction inherit from fraction.



More information about the Digitalmars-d mailing list