看板 [ Python ]
討論串[問題] 請問OO的多型在Python上的意義為何
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓2(2推 0噓 0→)留言2則,0人參與, 最新作者uranusjr (←這人是超級笨蛋)時間11年前 (2013/11/19 12:54), 編輯資訊
0
0
0
內容預覽:
我覺得你根本沒搞懂 polymorphism 的概念.... 不過以最小幅度改寫你的程式 (並讓其符合 PEP8 與 new-style classes). class Super(object):. name = 'super'. def f(self):. print(self.name). c
(還有35個字)

推噓3(3推 0噓 2→)留言5則,0人參與, 最新作者featherlike (dumb)時間11年前 (2013/11/19 11:41), 編輯資訊
0
0
0
內容預覽:
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
下一頁
尾頁