I'm not sure if this is possible, but what I am trying to do is use a switch to decide what type a variable should be (i have 3 classes to choose from)
it says its not being declared, so is that because the sections of a switch are like functions and everything declared inside goes away when that part does?
if so, is it possible to use pointers to choose?
1 2 3 4 5 6 7 8 9 10 11 12 13 14
switch( number ) {
case 1:
firstClass *variableName;
variableName = new firstClass;
break;
case 2:
secondClass *variableName;
variableName = new secondClass;
break;
case 3:
thirdClass *variableName;
variableName = new thirdClass;
break;
}