インターフェイス If { ... } クラス Impl は If { ... } を実装します function test(type:Class, obj) { タイプの obj インスタンスを返します。 } test(If, new 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);
}
}