Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在动作脚本 3 中为 Class 类型的函数参数分配默认值
public function foo(param:Class = ????? ) { }
谢谢
你不能,但这里有一个解决方法来达到同样的效果:
public function foo(param:Class = null ):void { if(!param) { // this'll be your default class param = MyClass; } // here you can do: var bar:* = new param(); }