
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Interface Syntax and Use
|
229
In theory, when a class implements a method from an interface, it
should be able to define the method as either a class method (i.e.,
static) or an instance method. Unfortunately, a bug in ActionScript 2.0
prevents a class from using the static attribute when implementing a
method defined by an interface. Due to the bug, a method defined by
an interface cannot be implemented as a class method. If the method
in the implementing class must be a class method, then it should not
be listed in the interface at all.
A class can legally implement more than one interface by separating interface names
with commas, as follows:
class SomeName implements SomeInterface, SomeOtherInterface {
}
in which case, the class SomeName belongs to all three of the following datatypes:
SomeName, SomeInterface, and SomeOtherInterface. If a class implements two inter-
faces that define a method by the same name, but with different signatures, the fol-
lowing error occurs:
Multiple implemented interfaces contain same method with different types.
If, on the other hand, a class implements two interfaces that define a method by the
same name and with the exact same signature, no error occurs. The real question is
whether the class can provide the services required by both interfaces within ...