- Code: Select all
use System.Reflection
class Prog
var t as Type?
cue init
base.init
it = Tests(3)
.t = it.typeOf
def main
p = Prog()
a = Tests(2)
print a.aMethod(9)
o1 as Object[] = Object[](1)
obj as Object? = Activator.createInstance(.t, o1)
o2 as Object[] = Object[](5)
res = .t.invokeMember('AMethod', BindingFlags.Default | BindingFlags.InvokeMethod, nil, obj, o2) to int
print .t.name, res
class Tests
var n as int = 0
var s as String?
cue init(a as int)
base.init
.n = a
def typeOf as System.Type
return .getType
def aMethod(m as int) as int
return .n * m
pro strN as String?
get
return .s
set
.s = value
Regards,