Thread overview
overloading operator = ?
Mar 04, 2004
Nam
Mar 04, 2004
J Anderson
Mar 05, 2004
Walter
March 04, 2004
I don't see opAssign in Operator Overloading.
So whether and how can I overloading operator = ?
Please guide me.
Thanks ,



March 04, 2004
Nam wrote:

>I don't see opAssign in Operator Overloading.
>So whether and how can I overloading operator = ?
>Please guide me.
>Thanks ,
>  
>
You can't.

-- 
-Anderson: http://badmama.com.au/~anderson/
March 05, 2004
"Nam" <Nam_member@pathlink.com> wrote in message news:c26cgc$rt4$1@digitaldaemon.com...
> I don't see opAssign in Operator Overloading.
> So whether and how can I overloading operator = ?
> Please guide me.

Overloading of assignment operators is deliberately omitted. I think its benefits are swamped by the confusion and code bloat it leads to. Many of the benefits in C++ of = overloading is to keep track of memory pointers. This is irrelevant in D, which does automatic memory management. Additionally, class objects in D are by reference, not by value, so an = just copies the reference, not the members.