Missing compiler warning?

bearophile bearophileHUGS at lycos.com
Fri Oct 18 11:26:27 PDT 2013


Jonathan M Davis:

> The prime example is constructors.
>
> this(int a, string b)
> {
>  this.a = a;
>  this.b = b;
>  ...
> }

That example of yours shows a possible intermediate rule: when in 
a method you define a local variable that has the same name as an 
instance member, then the instance member must be referred with 
the "this." prefix inside that function. So that code will 
compile.

Bye,
bearophile


More information about the Digitalmars-d mailing list