Get ActionScript Classes that Implement an Interface

谁说我不能喝 提交于 2019-12-23 03:12:27

问题


In ActionScript (AS3) how do I find all the classes that implement a particular interface?


回答1:


In OOP terms, you never want to be able to do this: the primary characteristic of interfaces is they are terms of a contract. Any class can choose to fulfill that contract and be able to say "I implement this interface".

Any code that references an instance of the interface don't care what class actually implements it: they don't have to; that's the really cool part of interfaces.

But if you want to find out, grep for "implements IFred"

Cheers




回答2:


I've figured out how to do this and posted a demo on my blog. It uses the getDefinitionNames library mentioned in the comments above.




回答3:


In Flash Builder I use ctrl-h and search for method names or the actual name of the interface.



来源:https://stackoverflow.com/questions/1402193/get-actionscript-classes-that-implement-an-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!