user defined implicit casts

Jarrett Billingsley kb3ctd2 at yahoo.com
Sat Jul 28 08:11:39 PDT 2007


"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.

How would non-member operator overloads solve this problem anyway? 





More information about the Digitalmars-d mailing list