作者a82 (QQ)
看板Python
标题[问题] class
时间Tue Aug 14 11:50:11 2018
class A():
def __int__(self):
def b(self):
请问 class A() 括号内可传入哪些东西
可以传入 list 字串 数值吗
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 118.161.94.235
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1534218613.A.861.html
1F:→ dododavid006: 那个括号里的是你要继承的 class 08/14 12:07
2F:→ a82: 所以只能放入class 其他都不能放? 08/14 12:17
3F:推 handsomeLin: 不是能不能放的问题,是你放那些东西要干嘛... 08/14 12:21
4F:→ a82: 想知道是否能放入其他东西,或许这样写会可达到某种目的 08/14 12:30
5F:→ a82: 因为找不例子,想知道是不是真的不能这样用,还是自己不知道 08/14 12:31
6F:推 f496328mm: 你想放的东西, 可以放在 __init__ 08/14 12:43
7F:→ f496328mm: 或是其他 class 下的 function 08/14 12:43
8F:→ f496328mm: 或是 class A 下的 function 08/14 12:43
9F:→ TitanEric: 我觉得你要有系统的学过 才会知道怎麽写 这问题不太好 08/14 19:07
10F:→ s860134: 他可以放入其他东西喔~ 这个写法叫做继承 08/16 13:21
11F:→ s860134: 找本书作有系统的学习可以避免绕很多路 08/16 13:22