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.
精彩评论