This needs a different approach
    Saaa 
    empty at needmail.com
       
    Tue Apr 29 14:38:52 PDT 2008
    
    
  
> >
>> IFruit[] fruits = [APPLE, PLUM, APPLE ... PEAR, PLUM];
>>
>> Since all fruits inherit from IFruit, they can all be represented as 
>> IFruit references.  So, if you have an array of IFruit, you can put all 
>> different kinds of fruits in it.
>
> Calling 'fruit[2].eat();' would call eat() from that specific APPLE, 
> right?
Changing fruit[2] to PLUM would go how?
I would like the PLUM to retain data from that specific APPLE.
That data is of the same type over all fruits. 
    
    
More information about the Digitalmars-d-learn
mailing list