alias this private?

Ali Çehreli acehreli at yahoo.com
Mon Dec 10 14:06:25 PST 2012


On 12/10/2012 01:56 PM, js.mdnq wrote:

 > I guess the opGet,
 > which I'm still not familiar with, behaves a bit different when aliased.
 > Possibly because we are aliasing a operator(or method?)

I may have been too subtle before but opGet() is not an operator 
function. Although its name starts with op, it is still a member function.

 > which is
 > different than aliasing a type?

The way I understand it, the compiler looks at the return type of that 
function and uses that function when the object is used instead of that 
type. If 'int foo()' is used in alias this, because foo() returns int, 
the object is eligible to be used in place of an int. foo() gets called 
to produce that int value.

Ali



More information about the Digitalmars-d-learn mailing list