user defined implicit casts
Ender KaShae
astrothayne at gmail.ckom
Mon Jul 30 17:43:50 PDT 2007
Jarrett Billingsley Wrote:
> "Tristam MacDonald" <swiftcoder at gmail.com> wrote in message
> news:f8dndh$1c8l$1 at digitalmars.com...
> > While I would like to see this, I wopuld like to see a logical extension
> > of the last part even more: non-member operator overloads. This is an
> > incredibly neat feature from C++ that was lost somewhere along the way,
> > but I don't know if it was intentional or not...
>
> It was intentional. The problem with global or static (as in C#) operator
> overloads is that they cannot be virtual, and so you end up writing the
> non-virtual operator overloads which simply call a virtual implementation
> method on the object(s), which is pointless -- just make the overload
> virtual in the first place, and it works fine.
>
c++ has member, global, and static operator overloads it is up to the programmer to choose how to implement it, I think it would be nice if D had a similar mechanizm.
More information about the Digitalmars-d
mailing list