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

Yigal Chripun yigal100 at gmail.com
Thu Dec 13 01:52:22 PST 2007


Don Clugston wrote:
> Yigal Chripun wrote:
>>  > a question: should matrices be structs or classes?
>>
>> I'd like to clarify your question:
>> do you want to ask -
>> a) whether they should be value types or reference types?
>> or
>> b) whether they should be implemented with D structs or D classes?
> [snip]
>> I'm new to D, but from what little i know, if you want OOP behavior 
>> (and matrices would benefit from polymorphism) 
> 
> How? What matrix operations are polymorphic?

i can't think of any... you're right, my bad.
so in that case it does makes sense to use D structs.

My point was that for polymorphic types you need to use classes only, 
and that can be much simpler to achieve with reference semantics by 
default (although that's just an implementation detail).

for me, the distinction between PODs and "objects" should be the 
polymorphic behavior, not the size of it (maybe i didn't explain myself 
properly). Am i completely wrong here?



More information about the Digitalmars-d mailing list