Taking a copy of an object

Derek derek at psyc.ward
Thu Aug 3 16:24:57 PDT 2006


On Thu, 03 Aug 2006 17:12:39 -0600, Hasan Aljudy wrote:

> why an operator?
> a method/property is more suitable, I think.

Where does this train of thought stop? Why an operator for anything? Do we
need '=' '>=' '+=' etc... when we have all those useful opXXX functions
handy? Of course we do, because it makes coding easier to read and write.

The action of cloning an item is quite a common action and having to use a
method name is not as convenient as an operator. Also, an operator can act
with objects, structs, arrays, and basic-types where as method names don't
work so well with all types. This simplifies template construction.

-- 
Derek Parnell
Melbourne, Australia
"Down with mediocrity!"



More information about the Digitalmars-d mailing list