What can the community do to help D?

bearophile bearophileHUGS at lycos.com
Sat Oct 23 14:33:33 PDT 2010


Denis Koroskin:

> FWIW, similar problem exists:
> 
> class Foo
> {
>      void foo1()
>      {
>          struct Bar {}
>      }
> 
>      void foo2()
>      {
>          struct Bar { /* different set of fields and methods */ }
>          // using Foo.foo2.Bar here
>          // bang! linker errors
>      }
> }

I have tried this, with no errors:


class Foo {
    void foo1() {
        struct Bar { string s; }
    }

    void foo2() {
        struct Bar { int x;
            int spam() { return 1; }
        }
        Bar b = Bar(10);
        int y = b.spam();
    }
}

void main() {
    auto f = new Foo;
    f.foo2();
}


Are you able to show me code (or a bug report) that doesn't work?

Bye,
bearophile


More information about the Digitalmars-d mailing list