Nested struct member has no access to the enclosing class data
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Aug 6 14:40:59 PDT 2012
On Mon, Aug 06, 2012 at 11:32:15PM +0200, RivenTheMage wrote:
> Is it bug or feature? :)
>
> ------------
> class Foo
> {
> int i;
>
> struct Bar
> {
> int j;
>
> int foobar()
> {
> return i + j;
> }
> }
> }
> ------------
>
> main.d(ХХ): Error: this for i needs to be type Foo not type Bar
Try outer.i instead of just i.
T
--
Don't modify spaghetti code unless you can eat the consequences.
More information about the Digitalmars-d-learn
mailing list