Pay for Hesitation: AS3 interface notes

Pages

2010年4月12日 星期一

AS3 interface notes

1. All methods declared in an interface must not include an access-control modifier.

2. Variable definitions are not allowed. (However, interfaces can include get and set methods, which can be used to simulate variables.

3. A class implements two interfaces that define a method by the same name and with the exact the same name, no error occur(dangerous). The real question is whether the class can provide the services provided by both interfaces within a single method definition. In most cases, the answer is no.

4. Some developers also preface interface names with an "I" as in IMovable, IKillable.

5. An Interface can use the extends keyword to inherit from anther interface.

6. ActionScript interfaces also support multiple interface inheritance.

7. Marker interface ( empty interface, no behavior)

8. In a Java application, any class that is expected to be subclassed should be an implement of an interface. As such, it can be subclassed directly, or it can be used via composition by a class that inherits from another class.

沒有留言: