I have 3 different objects A, B and C. Depending on the the parameter given, I would like to choose among these different objects. In
A
B
C
you could do something like
if (key == "a") obj=new A(); else if (key == "b") obj=new B();