我在创建一个可以动态创建变量类型对象的子项时遇到了麻烦.这是我想要实现的一个例子:
class systemSettings
'some properties
end class
Class fireSystemSettings
inherits systemSettings
'some additional properties
end class
Class windSystemSettings
inherits systemSettings
'some additional properties
end class
sub createSystem(systemType as Type, arg1 as object, arg2 as object)
Dim newSystem as New systemType(arg1, arg2)
systemCollection.add(newSystem)
end sub
Run Code Online (Sandbox Code Playgroud)
我无法让它发挥作用.我做了一些研究,看了泛型类型,反射和其他工具,但我无法确定如何最好地解决这个问题.