开发者

How to test if a class reference implements an interface?

How can I test if a class reference implements an interface?

Note that the is and instanceof operators do not work with Class references.

开发者_运维百科

Example:

    public function set someClassref(value:Class):void
    {   
        if(value is IMyInterface)
        {
            _someClassref = value;
        }
        else
        {
            //
        }
    }


AS3 - Can I know if a class implements an interface (or is a subclass of another class)? has what appear to be the two most common solutions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜