<div>On Fri, Jul 13, 2012 at 11:59 PM, Era Scarecrow <span dir="ltr"><<a href="mailto:rtcvb32@yahoo.com" target="_blank">rtcvb32@yahoo.com</a>></span> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Friday, 13 July 2012 at 19:35:34 UTC, Gor Gyolchanyan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
The seed can't be an interface because it needs to contain state. For instance the progress towards becoming the respective fruit.<br>
</blockquote>
<br></div>
 The interface itself may not have state, but what uses the interface can have state. So i don't see an issue. Worse case you can use an abstract class which is a partial definition.<br>
<br>
interface Counter {<br>
  void addOne();<br>
  int getCount();<br>
}<br>
<br>
//A contains state and is both A and Counter.<br>
class A : Counter {<br>
  int x;<br>
  void addOne() {x++;}<br>
  void getCount() {return x;}<div class="im"><br>
}<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The seed needs to be aware of the fruit it came from to access the fruit's DNA to inherit the traits of that fruit when it grows into a fruit of its own. (Please note, that it's just an example).<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
A fruit can have multiple such seeds, each of which must have it's own state and connection to the same fruit they came from.<br>
</blockquote>
<br></div>
so far...<div class="im"><br>
class Fruit {<br>
 class Seed {<br>
  class Apple {}<br>
 }<br>
}<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><div class="im">
So, we start off by inheriting from Fruit, defining the properties of that fruit (It's an Apple, it's delicious and it goes great in a pie). Then we define several different types of Apple seeds, each of which need access to the apple.<br>

</div></blockquote>
<br>
Hmmm...<br>
interface Seed {}<br>
<br>
class Fruit {<br>
  class Appleseed : Seed {<br>
    class Apple {}<br>
  }<br>
<br>
  //or?<br>
  static class Apple {<br>
    class AppleSeed : Seed {} //multiple seeds, but need Fruit access?<br>
  }<br>
}<br>
<br>
or perhaps...?<br>
<br>
interface Seed{}<br>
interface Fruit{}<br>
<br>
//Apple knows it's a fruit..<br>
class Apple : Fruit {<br>
  //Appleseed is from the Apple (which is a fruit as well)<br>
  //Appleseed is a seed, we can have multiple seeds from Apple, all which know<br>
  //all about Apple's (and basic fruits) but not about non-appple seeds.<br>
  class Appleseed : Seed {<br>
  }<br>
}<br>
</blockquote></div><br>The seed itself must have private state, or else it would violate encapsulation and require nasty mixins.<br clear="all"><div>And as I said, fruit can't know about apple.</div><div><br></div>-- <br>
Bye,<br>Gor Gyolchanyan.<br>