看板
[ Python ]
討論串[問題] 請問OO的多型在Python上的意義為何
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁
內容預覽:
我覺得你根本沒搞懂 polymorphism 的概念.... 不過以最小幅度改寫你的程式 (並讓其符合 PEP8 與 new-style classes). class Super(object):. name = 'super'. def f(self):. print(self.name). c
(還有35個字)
內容預覽:
class super1:. def f(self):. print('super1'). class sub1(super1):. def f(self):. print('sub1'). class sub2(super1):. def f(self):. print('sub2'). list
(還有45個字)
首頁
上一頁
1
下一頁
尾頁