Ref and class function calls?

Ali Çehreli acehreli at yahoo.com
Tue Apr 16 08:27:10 PDT 2013


On 04/16/2013 07:57 AM, Tofu Ninja wrote:

 > seems like bad design to
 > have a function that is fully intended to be a class function but not
 > actually be able to declare it within the class block.

It would be bad design if a class variable decided to refer to another 
object without the owner of that variable knowing about it.

I think the most accurate reason why this is not possible is that the 
'this' reference inside a member function is just a local class variable 
(or "handle"). If you could make it refer to a new object, then only 
that local reference would be affected and the outside variable would 
not know about it.

Ali



More information about the Digitalmars-d-learn mailing list