On Wednesday, 12 August 2015 at 15:24:43 UTC, sigod wrote:
[Nested classes][0] maybe?


Example with them:

class Foo {
        int x;
class Bar_ { // underscore cuz we have to declare variable too
                int x;
                int getFooX() { return this.outer.x; }
                class FooBar_ {
                        int x;
                        int y;
int addXes() { return x + this.outer.x + this.outer.outer.x; }
                }
                FooBar_ FooBar;
                this() {
FooBar = new FooBar_; // the var must also be initialized in a ctor
                }
        }
        Bar_ Bar;
        this() {
                Bar = new Bar_; // same out here
        }
}
void main() {
        auto foo = new Foo();
        import std.stdio;
        writeln(foo.Bar.FooBar.addXes());
}

Reply via email to