This needs a different approach
Saaa
empty at needmail.com
Mon Apr 28 13:59:45 PDT 2008
I think I get your code now :)
Tell me if I'm wrong:
This approach makes initializing the fruits list a bit more complex.
Changing an item in the list to another fruit requires the GC (the previous
instance needs to be deleted)
Changing an item is more costly than changing a number. (A lot of the items
get changed 30 times per second)
Wouldn't a function table be more appropriate?
>
> So with the get method I outlined above, the switch code becomes:
>
> get(data[i].type).eat();
>
> -Steve
>
More information about the Digitalmars-d-learn
mailing list