Difference between revisions of "CLASS - Scoping"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Specify scoping in user-defined class | Specify scoping in user-defined class | ||
Line 11: | Line 4: | ||
==Syntax== | ==Syntax== | ||
− | LOCAL | PRIVATE | PUBLIC | STATIC | + | LOCAL | PRIVATE | PUBLIC | STATIC : |
==See Also== | ==See Also== | ||
− | [[ADDPROPERTY()]], [[CLASS]], [[CLASS - Methods]], [[CLASS - Parameters]], [[CLASS - Properties]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DODEFAULT()]], [[METHOD]], [[NEWOBJECT()]], [[REMOVEPROPERTY()]] | + | [[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]] |
Line 34: | Line 27: | ||
|- | |- | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 52: | Line 33: | ||
// Use of Scope Options | // Use of Scope Options | ||
class myclass | class myclass | ||
− | public: | + | public: |
− | property cPUBLIC_PROPERTY | + | property cPUBLIC_PROPERTY |
− | + | method Show && Publicly available method | |
− | method Show && Publicly available method | + | //... |
− | //... | + | return && Show |
− | return && Show | + | private: |
− | + | property cPRIVATE_PROPERTY | |
− | private: | + | local: |
− | property cPRIVATE_PROPERTY | + | property cLOCAL_PROPERTY |
− | local: | + | static: |
− | property cLOCAL_PROPERTY | + | property cSTATIC_PROPERTY |
− | static: | + | |
− | property cSTATIC_PROPERTY | + | |
endclass | endclass | ||
Line 73: | Line 52: | ||
==Products== | ==Products== | ||
− | Recital | + | Recital Server, Recital |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Commands]] | [[Category:Commands]] | ||
+ | [[Category:Objects]] | ||
+ | [[Category:Objects Commands]] |
Latest revision as of 11:43, 13 January 2010
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