9.4 Class body

A class body may contain variable definitions, namespace definitions, function definitions, and statements:

class A
{
    static var x
    static function f() {}
    var y
    function g() {}
    trace("class loaded")
}

Note that it is not an error to define a class and instance property with the same name, as in the following example:

class A {
    static var x
    var x
}

It is also not an error to define a class property with the same name as a visible class property in a base class:

class A {
    static var x
}
class B extends A {
    static var x
}

 

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

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