CLASS - Scoping

From Recital Documentation Wiki
Revision as of 11:43, 13 January 2010 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Specify scoping in user-defined class


Syntax

LOCAL | PRIVATE | PUBLIC | STATIC :


See Also

ACLASS(), ADDPROPERTY(), AMEMBERS(), CLASS, CLASS - Methods, CLASS - Parameters, CLASS - Properties, COMPOBJ(), CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, LIST CLASSES, LOADOBJECT(), METHOD, NEWOBJECT(), OBJECT(), PRINT_HTML(), PRINT_JSON(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SQL SELECT, WITH


Description

The visibility of the properties of an object is governed by their scope. The default visibility is public, but this can be changed by using one of the scoping commands. Once the scope is changed, it remains in effect on all property and method definitions that follow, until it is changed again or the ENDCLASS command is reached.


Scope Description
LOCAL Local properties and methods are visible only to the object where they are defined.
PRIVATE Private properties and methods are visible only to the object where they are defined and to all methods and properties of objects called by the object.
PUBLIC Public properties and methods are visible everywhere.
STATIC Static property values are shared by all objects of the same class.


Example

// Use of Scope Options
class myclass 
    public:
        property cPUBLIC_PROPERTY
        method Show  && Publicly available method
            //...
        return  && Show
    private:
        property cPRIVATE_PROPERTY
    local:
        property cLOCAL_PROPERTY
    static:
        property cSTATIC_PROPERTY 
endclass
 
oMyObj = New myclass()
display memory


Products

Recital Server, Recital