9.6.5 Inheriting instance methods

Instance methods are inherited by copying their instance traits down to the instance traits of the derived class.

9.6.5.1 Overriding instance methods

Methods inherited from a class may be overridden in the derived class if the overriding method is given the override attribute and if its name, number and type of parameters, and return type match exactly. It is an error to attempt to override a method with a method that has the same name, but does not have the same number of parameters or parameters of different types or different return type.

9.6.5.2 Implementing interface methods

Methods inherited from an interface must be implemented by a method with a name and signature that matches the inherited method. Interface methods are implemented by an instance method declared with the public attribute.

A method that has the public attribute implements all inherited interface methods with a matching identifier.

interface I 
{
    function m()
}
interface J 
{
    function m()
}
class A implements I,J
{
    public function m() { trace("A.m") }
}

In this example, the definition of m in class A satisfies both interfaces I and J.


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/specs/actionscript/3/as3_specification93.html