确保 Flash Pro 中的符号具有适当的 AS 链接,然后在 super 语句中使用传递构造函数参数:
演员 - 基类
package
{
public class Actor
{
public function Actor(name:String, role:String)
{
}
}
}
Player - 继承自定义自己的构造函数参数的 Actor:
package
{
public final class Player extends Actor
{
public function Player(... params:Array)
{
// pass desired inherited constructor parameters
super("name", "role");
}
}
}
Enemy - 从定义自己的构造函数参数的 Actor 继承:
package
{
public final class Enemy extends Actor
{
public function Enemy(... params:Array)
{
// pass desired inherited constructor parameters
super("name", "role");
}
}
}