On Friday, 13 July 2012 at 19:08:54 UTC, Gor Gyolchanyan wrote:

If you make seed static, then Appleseed & apple will have access to Fruit but seed (by itself) won't. Other combinations faile as far as I can tell. How far you can take inner class inheritance I don't know, but it seems not that many levels.

This all won't work, because having Fruit know about Apple defeats the
whole purpose.

So why not...??

class Seed{} //same as static class in fruit

class Apple {
  class Appleseed : Seed {}
}

Perhaps you would rather have Seed as an interface instead? It seems like I need a full detail of how everything connects together, so let's see..

 Fruit covers apple (but maybe not seed)
Apple covers (and is a class of) fruit, but also contains a seed (or the seed pertains to Apple specifically) All fruits (including apple's) have seeds that do specific things, namely plant, water and grow, and perhaps produceFruit.

If that isn't right, explain how the relationship of it all goes and a possible solution may show itself.

Reply via email to