CreateInstance Function | |
Create an object.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION CreateInstance(
symClassName,
InitArgList
) AS Object CLIPPER
[ClipperCallingConventionAttribute(new string[] { ... })]
public static Object CreateInstance(
Usual symClassName = default,
Usual InitArgList = default
)
Request Example
View SourceParameters
- symClassName (Optional)
- Type: Usual
The name of the class for which you want to create an object. - InitArgList (Optional)
- 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