www.digitalmars.com         C & C++   DMDScript  

D - overloading operator = ?

reply Nam <Nam_member pathlink.com> writes:
I don't see opAssign in Operator Overloading.
So whether and how can I overloading operator = ?
Please guide me.
Thanks ,
Mar 03 2004
next sibling parent J Anderson <REMOVEanderson badmama.com.au> writes:
Nam wrote:

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

-- -Anderson: http://badmama.com.au/~anderson/
Mar 03 2004
prev sibling parent "Walter" <walter digitalmars.com> writes:
"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.
Mar 05 2004