Difference between revisions of "NEW Operator"

From Lianjapedia
Jump to: navigation, search
(Created page with "==Purpose== Create a new object based on a class ==Syntax== NEW <classname>([<arg> [, ...]]) ==See Also== ACLASS(), ADDPROPERTY(), AMEMBERS(), COMPOBJ(), C...")
 
(No difference)

Latest revision as of 07:08, 7 April 2017

Purpose

Create a new object based on a class

Syntax

NEW <classname>([<arg> [, ...]])

See Also

ACLASS(), ADDPROPERTY(), AMEMBERS(), COMPOBJ(), CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, LIST CLASSES, LOADOBJECT(), NEWOBJECT(), OBJECT(), PRINT_HTML(), PRINT_JSON(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SET CLASSLIB, SQL SELECT, WITH

Description

The NEW operator is used to create a new object based on the class <classname>. The <classname> should be followed by brackets (). Parameters can optionally be passed to the object's init method.

The NEWOBJECT() function returns a reference to the newly created object.

Example

define class product as custom
	productname = "Lianja App Builder"
	version = "3.4"
	proc init(arg1)
		? etos(arg1)
	endproc
	proc getver
		? this.version
	endproc
enddefine
 
oProduct = new product("Hello World")
oProduct.getver()
? oProduct.productname