Just curious, can you override an override in actionscript 3
+2
A:
yes you can... here is some pseudo-code
public class Test1
{
public function doSomething():void
{
trace( 'Test1' );
}
}
public class Test2 extends Test1
{
override public function doSomething():void
{
super.doSomething();
trace( 'Test2' );
}
}
public class Test3 extends Test2
{
override public function doSomething():void
{
super.doSomething();
trace( 'Test3' );
}
}
jeremynealbrown
2010-04-27 20:04:42
+6
A:
Yes.
class Foo {
public function bar():void { }
}
class Foo2 extends Foo {
override public function bar():void { }
}
class Foo3 extends Foo2 {
override public function bar():void { }
}
Note that super.bar
in Foo3
will necessarily refer to Foo2.bar
. Therefore if you expect to be doing this it's sometimes handy to create a protected
function in Foo2
that just calls super.bar
so that you can access the base implementation when necessary.
Cory Petosky
2010-04-27 20:04:42