python abstract factory implementation demo

Model = INPUT ( " Choose Module: " ) 
the class_ = INPUT ( " Please select the type: " ) 
Money = INPUT ( " Please enter the amount: " ) 

# Import Module 
Model = __import__ (Model) 

# instantiate an object 
Object = getattr ( Model, class _) (Money)
 # call the object methods -pay 
object.pay ()

operation result:

Please select the module: factory_method 
Please select the type: BenBen 
Please enter the amount: 100 
received a financial payment amount Benben 100

Guess you like

Origin www.cnblogs.com/benben-wu/p/12158381.html