access subclass functions

Saaa empty at needmail.com
Fri Nov 21 02:13:06 PST 2008


You mean something like this ?

struct fruits
{
    Banana banana();
    Apple apple();
}

I now use foreach(int i, Fruit fruit; fruits) a lot.
How do I iterate over all elements when I use the above?


> Saaa Wrote:
>
>> >> this wrong:
>> >> fruits[BANANA].peel();
>> >
>> > why not using struct?
>>
>> How do you mean?
>> What should be a struct?
>>
> typed array. 




More information about the Digitalmars-d-learn mailing list