开发者

How to test if a class reference implements an interface?

开发者 https://www.devze.com 2023-02-05 03:54 出处:网络
How can I test if a class reference implements an interface? Note that the is and instanceof operators do not work with Class references.

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

精彩评论

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