<div class="gmail_quote">On Sat, Jul 14, 2012 at 9:12 PM, Benjamin Thaut <span dir="ltr"><<a href="mailto:code@benjamin-thaut.de" target="_blank">code@benjamin-thaut.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The only problem about this is:<br>
<br>
class Fruit<br>
{<br>
  class Seed {<br>
    void SetFruit(Fruit fruit)<br>
    {<br>
      this.outer = fruit;<br>
    }<br>
  }<br>
}<br>
<br>
class Apple: Fruit<br>
{<br>
  void AppleOnlyMethod(){ ... }<br>
<br>
  class AppleSeed: Fruit.Seed {<br>
    void DoSomething()<br>
    {<br>
      AppleOnlyMethod();<br>
    }<br>
  }<br>
<br>
  auto GetNewSeed() { return new AppleSeed(); }<br>
}<br>
<br>
auto apple = new Apple();<br>
auto seed = apple.GetNewSeed();<br>
seed.SetFruit(new Fruit());<br>
seed.DoSomething(); //what happens here?<br>
<br>
Kind Regards<span class="HOEnZb"><font color="#888888"><br>
Benjamin Thaut<br>
<br>
</font></span></blockquote></div><br>I think this.outer is not an lvalue, which solves the problem. It wouldn't make sense to have it an lvalue, because the object is specifically created out of the initial outer object.<br clear="all">
<div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br>