开发者

Using constants in object declaration?

开发者 https://www.devze.com 2022-12-18 15:16 出处:网络
I want to create a function pointer object: private var func:Object = { Class开发者_Python百科.Constant: function };

I want to create a function pointer object:

private var func:Object = { Class开发者_Python百科.Constant: function };

What is the clean way of doing this? I did the above and got

Error: Syntax error: expecting colon before dot.

And I'm not even sure that's right. The goal is that I can just do

func[ Constants ]();

somewhere later.


Try this:

private var func:Object = { };
func[ Class.CONSTANT ] = function() { };
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号