Explicitly overriding constructors in ActionScript3

All,

I came across this funny thing in another post. I was told that you can explicitly override the constructor ... which doesn't seem necessary, and I'm a little surprised that it even compiles. Take a look:

public class TestClass
{
    public function TestClass() {}
}

public class TestClass2 extends TestClass
{
    public override function TestClass2() {}
}

An explicit call to override in a constructor can be just no-op, as it is certainly not necessary. My question is : Do I have a subtlety that I miss? Is constructor overriding explicitly something to say to the compiler?

+5
source share
2 answers

, , as3:)
imho bytecode swf overriden contstructor swf

+1
public class TestClass
{
    public function TestClass() {}
}

public class TestClass2 extends TestClass
{
    public override function TestClass2() {
       super();//this makes call to the default constructor
}
+2

All Articles