All,
I ran into this funny thing in a different post. It was pointed out to me that you can explicitly override a constructor... which doesn't seem necessary, and I am a little surprised it even compiles. Take a look:
public class TestClass
{
public function TestClass() {}
}
public class TestClass2 extends TestClass
{
public o开发者_JAVA百科verride function TestClass2() {}
}
Explicitly calling override on the constructor might just be a no-op, as it is certainly not necessary. My question: Is there a subtlety here that I am missing? Does explicitly overriding the constructor tell the compiler something?
public class TestClass
{
public function TestClass() {}
}
public class TestClass2 extends TestClass
{
public override function TestClass2() {
super();//this makes call to the default constructor
}
i think it's just a bit of freedom provided by as3 syntax :)
imho bytecode of an swf with overriden contstructor is equal to one of swf with a normal one
精彩评论