nested class inheritance
kenji hara
k.hara.pg at gmail.com
Sat Jul 14 10:21:21 PDT 2012
2012/7/15 Benjamin Thaut <code at benjamin-thaut.de>:
> The only problem about this is:
>
> class Fruit
> {
> class Seed {
> void SetFruit(Fruit fruit)
> {
> this.outer = fruit;
Setting to pseudo variable 'outer' should be rejected in compilation.
Please report it to bugzilla.
> }
> }
> }
>
> class Apple: Fruit
> {
> void AppleOnlyMethod(){ ... }
>
> class AppleSeed: Fruit.Seed {
> void DoSomething()
> {
> AppleOnlyMethod();
> }
> }
>
> auto GetNewSeed() { return new AppleSeed(); }
> }
>
> auto apple = new Apple();
> auto seed = apple.GetNewSeed();
> seed.SetFruit(new Fruit());
> seed.DoSomething(); //what happens here?
>
> Kind Regards
> Benjamin Thaut
>
Kenji Hara
More information about the Digitalmars-d
mailing list