Difference between revisions of "CLASS - Parameters"
Helengeorge (Talk | contribs) (→Products) |
Helengeorge (Talk | contribs) (→Products) |
||
Line 60: | Line 60: | ||
==Products== | ==Products== | ||
− | Recital Server, Recital | + | Recital Server, Recital |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Commands]] | [[Category:Commands]] | ||
[[Category:Objects]] | [[Category:Objects]] | ||
[[Category:Objects Commands]] | [[Category:Objects Commands]] |
Revision as of 14:43, 10 November 2009
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
ADDPROPERTY(), CLASS, CLASS - Methods, CLASS - Properties, CLASS - Scoping, CREATEOBJECT(), DEFINE CLASS, DODEFAULT(), METHOD, NEWOBJECT(), REMOVEPROPERTY()
Description
The PARAMETER 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