接口如果 { ... } 类 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);
}
}