Difference between revisions of "NEWOBJECT()"
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
==Syntax== | ==Syntax== | ||
− | NEWOBJECT(<expC1> [, <exp1>, <exp2>, ...]]]) | + | NEWOBJECT(<expC1> [, <expC2> [, <exp1> [, <exp2> [, ...]]]]) |
==See Also== | ==See Also== | ||
− | [[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[COMPOBJ()]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DISPLAY CLASSES]], [[DODEFAULT()]], [[FOREACH]], [[LIST CLASSES]], [[LOADOBJECT()]], [[OBJECT()]], [[PRINT_HTML()]], [[PRINT_JSON()]], [[PRINT_R()]], [[PRINT_XML()]], [[REMOVEPROPERTY()]], [[REQUIRE_ONCE()]], [[SAVEOBJECT()]], [[SQL SELECT]], [[WITH]] | + | [[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[COMPOBJ()]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DISPLAY CLASSES]], [[DODEFAULT()]], [[FOREACH]], [[LIST CLASSES]], [[LOADOBJECT()]], [[NEW Operator]], [[OBJECT()]], [[PRINT_HTML()]], [[PRINT_JSON()]], [[PRINT_R()]], [[PRINT_XML()]], [[REMOVEPROPERTY()]], [[REQUIRE_ONCE()]], [[SAVEOBJECT()]], [[SET CLASSLIB]], [[SQL SELECT]], [[WITH]] |
==Description== | ==Description== | ||
− | The NEWOBJECT() function is used to create a new object. The <expC1> is | + | The NEWOBJECT() function is used to create a new object. The <expC1> is the class on which the new object is based. If <expC1> is defined in a class library, the class library can be specified in <expC2>, otherwise it must be explicitly opened with [[SET CLASSLIB]]. If the class library does not have a '.vcp' extension, the full filename should be specified. Parameters can be passed to the object's init method in <exp1>, <exp2>, ... . |
− | the class on which the new object is based. | + | |
The NEWOBJECT() function returns a reference to the newly created object. | The NEWOBJECT() function returns a reference to the newly created object. | ||
Line 16: | Line 15: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | class | + | // myclasslib.vcp |
− | + | define class Product as custom | |
− | + | productname = "Lianja App Builder" | |
− | + | version = "1.0" | |
− | + | proc init(arg1) | |
− | + | ? etos(arg1) | |
− | + | endproc | |
− | + | proc getver | |
− | + | ? this.version | |
− | + | endproc | |
− | + | enddefine | |
+ | // end of myclasslib.vcp | ||
− | + | oProduct = newobject("Product","myclasslib","Hello World") | |
− | + | ||
− | + | ||
</code> | </code> | ||
Line 36: | Line 34: | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:Objects]] | [[Category:Objects]] | ||
− | [[Category: | + | [[Category:Declaring Variables and Arrays]] |
Latest revision as of 07:01, 7 April 2017
Contents
Purpose
Function to create a new object
Syntax
NEWOBJECT(<expC1> [, <expC2> [, <exp1> [, <exp2> [, ...]]]])
See Also
ACLASS(), ADDPROPERTY(), AMEMBERS(), COMPOBJ(), CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, LIST CLASSES, LOADOBJECT(), NEW Operator, OBJECT(), PRINT_HTML(), PRINT_JSON(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SET CLASSLIB, SQL SELECT, WITH
Description
The NEWOBJECT() function is used to create a new object. The <expC1> is the class on which the new object is based. If <expC1> is defined in a class library, the class library can be specified in <expC2>, otherwise it must be explicitly opened with SET CLASSLIB. If the class library does not have a '.vcp' extension, the full filename should be specified. Parameters can be passed to the object's init method in <exp1>, <exp2>, ... .
The NEWOBJECT() function returns a reference to the newly created object.
Example
// myclasslib.vcp define class Product as custom productname = "Lianja App Builder" version = "1.0" proc init(arg1) ? etos(arg1) endproc proc getver ? this.version endproc enddefine // end of myclasslib.vcp oProduct = newobject("Product","myclasslib","Hello World")