十分钟学会Python, 简单入门教程(15)

http://www.smzswang.com时间:2016-10-23 14:21来源:未知

  30

  # This will not update the variable on the class,

  # instead it will bind a new object to the old

  # variable name.

  >>> classinstance.common = 10

  >>> classinstance.common

  10

  >>> classinstance2.common

  30

  >>> MyClass.common = 50

  # This has not changed, because "common" is

  # now an instance variable.

  >>> classinstance.common

  10

  >>> classinstance2.common

  50

  # This class inherits from MyClass. The example

  # class above inherits from "object", which makes

【免责声明】本文仅代表作者个人观点,与中国数码招商网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。您若对该稿件内容有任何疑问或质疑,请联系本网将迅速给您回应并做处理。

相关新闻