@tianzhidao28
2015-04-26T03:40:36.000000Z
字数 396
阅读 1134
不解
面向对象高级编程
69次阅读
数据封装、继承和多态只是面向对象程序设计中最基础的3个概念。在Py thon中,面向对象还有很多高级特性,允许我们写出非常强大的功能。
我们会讨论多重继承、定制类、元类等概念。
class Cls(object):
def init(self):
self.__x = None
@property
def x(self):
return self.__x
@x.setter
def x(self, value):
self.__x = value
@x.deleter
def x(self):
del self.__x
if name == 'main':
c = Cls()
c.x = 100
y = c.x
print("set & get y: %d" % y)
del c.x
print("del c.x & y: %d" % y)
为什么是C.X 而不是C.x()
什么鬼