So I am thinking through the first project that I would like to use objects for and hit an immediate road block that I am hoping there is a quick answer to. I have a need to be able to dynamically create classes. So let's say I have a class called Class1 and it implements two interfaces called Interface1 and Interface2. I would like to be able to create 10 instances of the object at runtime each using an interface that I detect at runtime. So my question centers around the following code:
Local oInterface1 As Interface1
Let oInterface1 = Class "Class1"
What if I don't know at compile time whether I will need Interface1 or Interface2? Any ideas how to safely do this or even how to do this at all? The ideal solution would be something like a function I could call that would return an instance of the proper Interface.
Anyone have any ideas or is this simply not possible?
Local oInterface1 As Interface1
Let oInterface1 = Class "Class1"
What if I don't know at compile time whether I will need Interface1 or Interface2? Any ideas how to safely do this or even how to do this at all? The ideal solution would be something like a function I could call that would return an instance of the proper Interface.
Anyone have any ideas or is this simply not possible?
Comment