NEWOBJECT()

From Lianjapedia
Jump to: navigation, search

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")