Reputation: 855
How can I assign a default value for a function parameter of type Class in Action script 3
public function foo(param:Class = ????? )
{
}
Thanks
Upvotes: 0
Views: 184
Reputation: 12333
You can't, but here's a workaround to achieve the same effect:
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();
}
Upvotes: 1