_CreateInstance Function (Type, Usual) | |
Create an object.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION _CreateInstance(
type AS Type,
InitArgList AS USUAL[]
) AS Object
public static Object _CreateInstance(
Type type,
Usual[] InitArgList
)
Request Example
View SourceParameters
- type
- Type: Type
The type object that descrives the the object that needs to be created. - InitArgList
- Type: Usual
A comma-separated list of arguments to pass to the Init() method of symClassName (see example below).
Return Value
Type:
ObjectRemarks
CreateInstance() is the functional way to create an object of a particular class.
It is essentially the same as creating an object through an invocation of {}, but is useful in situations where a functional form is needed.
Examples
This example shows how an object is created using CreateInstance():
1CLASS Person
2 EXPORT name, sign
3CONSTRUCTOR(tName, tSign)
4 name := tName
5 sign := tSign
6END CLASS
7
8FUNCTION Start()
9 LOCAL x AS OBJECT
10
11
12 x := CreateInstance(#PERSON, "Odile", "H")
13 ? x:name
See Also