nested class inheritance

Benjamin Thaut code at benjamin-thaut.de
Sat Jul 14 15:55:14 PDT 2012


Am 14.07.2012 19:30, schrieb Gor Gyolchanyan:
> On Sat, Jul 14, 2012 at 9:23 PM, Benjamin Thaut <code at benjamin-thaut.de
> <mailto:code at benjamin-thaut.de>> wrote:
>
>     Am 14.07.2012 19:21, schrieb kenji hara:
>
>         2012/7/15 Benjamin Thaut <code at benjamin-thaut.de
>         <mailto: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
>
>
>     I will not report this, beacuse it will break my custom new operator
>     (template) for inner classes ;-)
>
>     Kind Regards
>     Benjamin Thaut
>
>
> That's most unwise, because if it's not supposed to be like that it will
> get fixed anyway, so you better start replacing your custom new operator.
>
> --
> Bye,
> Gor Gyolchanyan.

Replacing my custom new operator exactly by what? Overloading the build 
in new is deprecated...



More information about the Digitalmars-d mailing list