opXxxAssign "return value"

Lionello Lunesu lio at lunesu.remove.com
Sun Dec 17 23:15:06 PST 2006


Stewart Gordon wrote:
> Lionello Lunesu wrote:
>> Forget about the '*this'.. I was mixing C++ and D again :S
> 
> For structs, it still needs to be *this.
> 
> Stewart.

I was referring to Walter's post, where he said that a opAssign for 
class C should return C (return this) and for a struct S it should 
return S* (also, return this). In C++ it would be S& (return *this).

L.



More information about the Digitalmars-d mailing list