Difference between revisions of "CLASS - Parameters"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Define a parameter list for a method inside a user-defined class | Define a parameter list for a method inside a user-defined class | ||
Line 12: | Line 8: | ||
==See Also== | ==See Also== | ||
− | [[ADDPROPERTY()]], [[CLASS]], [[CLASS - Methods]], [[CLASS - Properties]], [[CLASS - Scoping]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DODEFAULT()]], [[METHOD]], [[NEWOBJECT()]], [[REMOVEPROPERTY()]] | + | [[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[CLASS]], [[CLASS - Methods]], [[CLASS - Properties]], [[CLASS - Scoping]], [[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== | ==Description== | ||
− | The | + | The PARAMETERS command is used inside the CLASS...ENDCLASS construct to define a parameter list for a method. You can pass parameters to methods just as you would to regular functions. If the method name is called CONSTRUCTOR then the parameters are passed to this method when you create the object. |
====<name>==== | ====<name>==== | ||
Line 64: | Line 60: | ||
==Products== | ==Products== | ||
− | Recital | + | Recital Server, Recital |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Commands]] | [[Category:Commands]] | ||
+ | [[Category:Objects]] | ||
+ | [[Category:Objects Commands]] |
Latest revision as of 11:38, 13 January 2010
Contents
Purpose
Define a parameter list for a method inside a user-defined class
Syntax
PARAMETERS <name> [AS CHARACTER | NUMERIC | LOGICAL | DATE | <class name>] [, ...]
See Also
ACLASS(), ADDPROPERTY(), AMEMBERS(), CLASS, CLASS - Methods, CLASS - Properties, CLASS - Scoping, 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 PARAMETERS command is used inside the CLASS...ENDCLASS construct to define a parameter list for a method. You can pass parameters to methods just as you would to regular functions. If the method name is called CONSTRUCTOR then the parameters are passed to this method when you create the object.
<name>
The parameter <name> is the name of a memory variable or array.
AS CHARACTER | NUMERIC | LOGICAL | DATE
The data type of values assigned to a property within an object can be checked at run-time by associating a data type with the property in the class definition. The AS clause is used to perform data scoping. Once a variable has been defined to a specific data type, you cannot change its data type by assigning it a value from a different data type. Doing this will result in the run-time error "Data type mismatch".
AS <class name>
A property data type can inherit a class <class name>, and its members and their implementation from another class. Inheritance enables developers to build a hierarchy of descendant objects. The specification of a property data type as an existing class name provides for construction of a class hierarchy. The inheriting class is called a derived class, and the class that the derived class inherits is called a base class.
Example
class Box method Draw parameters nX1, nY1, nX2, nY2, cFGCOL, cBGCOL @nX1,nY1 clear to nX2,nY2 @nX1,nY1 fill to nX2,nY2 ; color &(cFGCOL + "/" + cBGCOL) @nX1,nY1 to nX2,nY2 ; color &(cFGCOL + "/" + cBGCOL) return && Draw endclass class Dialog1 of Box property lOK method Show parameters nX1, nY1, nX2, nY2, cMESSAGE this.Draw(nX1,nY1,nX2,nY2, "n", "bg") @nX1 + 2,nY1 + int((nY2 - nY1 - ; len(cMESSAGE))/2) say cMESSAGE color w+/bg @nX2 - 2,nY1 + int((nY2 - nY1 - 5)/2) ; menu [ <Ok ] menu quit this.lOK = (not empty(menuitem())) @0,0 clear to 0,79 return && Show endclass oDIALOGOK = new Dialog1() oDIALOGOK.Show(5,25,12,54, "Completed") ? oDIALOGOK.lOK ?
Products
Recital Server, Recital