Another object question

BlitzMax Forums/BlitzMax Beginners Area/Another object question

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

[quote]If I do the loop on displayobjects (since that is what is added to the list) do I get the associated playerselection object as well?[quote]Ys and no. Here's how polymorphism works:

If you itterate through your basetype (in your example), you do get the extended types, however you can only directly manipulate objects through methods defined in the basetypes interface.

So in your case you would not be able to handleinput, without a specific downcast, however if the playerselection objects had a different implementation of showitem() than the basetype, then the playerselection version would be the one invoked.