alias can't find symbol or can't use symbol

Carl Sturtivant via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 30 09:08:33 PDT 2017


On Sunday, 30 April 2017 at 02:19:29 UTC, bauss wrote:
> What exactly did you expect here?
>
> 'n' is not in the scope of 'outer'.
>
> 'n' is in the scope of 'member'.
>
> Of course it works with 'x.n' since 'x' points to the 'member' 
> declared inside 'outer'.
>
> I mean it would have worked with classes, but structs are 
> different does not have any type of actual inheritance, which 
> is what you're trying to achieve.
>
> ```
> class member {
>     int n;
> }
>
> class outer : member {
>     alias n2 = n; // Ok ...
> }
> ```

It did NOT work with x.n as I asserted. And `alias x this` brings 
n into the scope of outer. So your reply makes no sense.



More information about the Digitalmars-d-learn mailing list