0
接口如果 { ... }
类 Impl 实现 If { ... }

功能测试(类型:类,obj){
  返回 obj instanceof 类型;
}

测试(如果,新的 Impl());

最后一行的调用test返回 false,但它应该为 true。我怎样才能正确地进行此检查,并要求它必须在函数内部?


真实代码:

    public function iterate(callback:Function, type:Class = null) {
        for (var node:EntityListNode = beginNode; node != null; node = node.next) {
            if (type == null || node.entity instanceof type) callback(node.entity);
        }   
    }
4

1 回答 1

1

if(Object is IInterface)......适用于那个AFAIK。

于 2010-03-08T13:54:30.940 回答