class BaseCls:
def foo(self):
print("BaseCls")
class ChildClsA(BaseCls):
def foo(self):
print("ChildClsA")
class ClildClsB(BaseCls):
def foo(self):
print("ChildClsB")
inputStr=raw_input("press A or B\n")
if(inputStr=="A"):
obj=ChildClsA()
if(inputStr=="B"):
obj=ClildClsB()
obj.foo()
'if' statement can deal with this situation. However, how to decide creating a child class without using 'if' statement When I have more than one hundred children of BaseCls,