python 多态

 1 class foo:
 2     def f1(self):
 3         print('f1')
 4 
 5 class bar:
 6     def f1(self):
 7         print('f1')
 8 
 9 def func(args):
10     args.f1()
11 
12 func(foo())
13 func(bar())

 

posted @ 2017-02-24 08:14  Erick-LONG  阅读(191)  评论(0编辑  收藏  举报