Exemple #1
0
from myobjectfactory import MyObjectFactory

myobj = MyObjectFactory.create_object('myotherclass')
myobj.do_something('something')

myobj = MyObjectFactory.create_object('myclass')
myobj.do_something('something')

# Not doing something
# Doing something
Exemple #2
0
from myobjectfactory import MyObjectFactory

myObj = MyObjectFactory.create_object('myotherclass')  #"myotherclass"

if myObj:
    myObj.do_something('something')
else:
    print('Not doing anything.')