nested class inheritance

Era Scarecrow rtcvb32 at yahoo.com
Fri Jul 13 11:45:14 PDT 2012


On Friday, 13 July 2012 at 18:34:06 UTC, Gor Gyolchanyan wrote:
> I need Seed to have a reference to Fruit because there will be 
> more then one derivative of Seed in the same derivative of 
> Fruit and they all need to store data inside the fruit and 
> communicate with each other in that way. That's why Seed can't 
> be static. What can I do to have multiple seeds in the same 
> fruit with all seed-fruit-seed communication hidden in the base 
> classes?


  Then perhaps have the inherited class within fruit?

class Fruit {
   class Seed {}
   class Appleseed : Seed {}
}


More information about the Digitalmars-d mailing list