nested class inheritance
Benjamin Thaut
code at benjamin-thaut.de
Sat Jul 14 10:12:57 PDT 2012
The only problem about this is:
class Fruit
{
class Seed {
void SetFruit(Fruit fruit)
{
this.outer = fruit;
}
}
}
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
More information about the Digitalmars-d
mailing list