Object orientated woes

I was just wondering if anybody has a way of implementing oo techniques such as polymorphism on the IPhone.
I seem to have run into a dead end with code that formely worked on the PC.
Basically, what I want to do is put some objects of the same inheritance tree into an array and then loop through the array and call the same method on each object.
Crudely in pseudo code

var message = messages[ pageCtr ];
message.display()

The problem is that the interpreter sees the items in the array as objects and does not recognise the method ( in this case display )
I can caste of course; doing something like this;

var message:smile:isplayBaseClass = messages[ pageCtr ];
message.display();

Now my problem is that the interpreter will think the object is this base class in every instance and will not recognise the overwritten method even though it will have the virtual key word. So if I had a DisplayChildClass it would not have its method called but that of it’s parent.
This situation totally limits the use of many design patterns in unity and throw up all kinds of redundancy and strong coupling issues. The only solution I can think of is to put a flag on every object and hope that this can be read and a switch statement used to enact polymorphism.
Any help / thoughts apreciated.[/quote]

That’s not what’s supposed to happen. The compiler is supposed to invoke the virtual function of the derived class, even if the reference is typed as a base class. If you experience it otherwise, you should probably file a bug report.

Oh right. I’ll test it one more time and possibly report it. Many thanks for the pointer.

Ok I’m officially an ass. I think virtual keyword had to be on both parent and child classes to work. Anyway it works when this is the case so I am very relieved. Hopefully somebody else might find this info useful.