ActionScript 3 Language Specification |
|||
| ActionScript 3.0 Language Specification > 1 Tutorial introduction > 1.7 Interfaces | |||
An interface defines a contract between an instance and code that uses that instance. When a class implements an interface, it guarantees that it will provide the methods declared in that interface. An implementing method must be declared public, in which case it will implement all unimplemented interface methods with the same identifier. An example of an interface follows:
interface Greetings {
function hello()
function goodmorning()
}
class Greeter implements Greetings {
public function hello() {
trace("hello, world")
}
public function goodmorning() {
trace("goodmorning, world")
}
}
var greeter : Greetings = new Greeter()
greeter.hello()
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/specs/actionscript/3/as3_specification9.html
Comments
No screen name said on Mar 1, 2006 at 5:55 AM :