[Flashcoders] upcasting causes overridden superclasses methods to be called

2006-11-14 Thread Matt Garland
I was hunting a bug when I found this out: class SuperClass { public function init() { trace (superclass init); } } class SubClass extends SuperClass{ public override function init(){ trace (subclass init); } } if you create a subclass instances and cast it (or type its variable) to the

Re: [Flashcoders] upcasting causes overridden superclasses methods to be called

2006-11-14 Thread Hans Wichman
Hi, running your example shows: subclass init, as it should. public override function init(){ trace (subclass init); } whats the override keyword doing there? greetz JC On 11/14/06, Matt Garland [EMAIL PROTECTED] wrote: I was hunting a bug when I found this out: class SuperClass { public

Re: [Flashcoders] upcasting causes overridden superclasses methods to be called

2006-11-14 Thread Peter Hall
I assume this is AS3 in Flash AS3 preview? I tried your example code and it worked as expected, even when I instantiated Subclass by a variable reference to the class. I have a feeling you have made some mistake in your code... if not, could you send a complete example, that we can just paste