as 覆盖
覆盖(override):
//CBase.as
package {
public class CBase {
public function Method() { trace("BaseMethod"); }
}
}
//CTest.as
package {
public class CTest extends CBase {
override public function Method() { trace("TestMethod"); }
}
}
//测试
var base:CBase = new CTest();
base.Method(); //TestMethod
//只有实例方法可以被覆盖, 须格式相同, 访问级别相同
//静态方法不能被覆盖, 也不会被继承
//final 方法可禁止覆盖