Hi I am working on a project which has a variable which is an instance of the class. The problem is that depending on which option the user picks the instance variable can be on of the classes.
How can I assign a variable to an instance of a class when it can be 1 class or another class?
For example,
//I don't know if this variable is going to be of type class 1 or class 2
//at this point any suggestions?
Class1 var1;
if(x == true)
{
var1 = new Class1
}
else
{
var1 = new Class2
}
Thanks in advance!