摘要: 1.面向对象高级1:http://www.cnblogs.com/ldq1996/p/8046339.html 2.面向对象高级2:http://www.cnblogs.com/ldq1996/p/8448648.html 3.面向对象的封装:http://www.cnblogs.com/ldq19 阅读全文
posted @ 2018-02-14 18:28 TAMAYURA 阅读(69) 评论(0) 推荐(0)
摘要: class Good(): def __init__(self): self.original=100 self.discount = 0.8 @property def price(self): new_price=self.original*self.discount return new_price ... 阅读全文
posted @ 2018-02-14 18:24 TAMAYURA 阅读(92) 评论(0) 推荐(0)
摘要: class Foo: def __func(self): #私有属性在定义阶段就发生变化,_Foo__func print('Foo') class Bar(Foo): def __func(self): #因为在定义阶段就发生了变化,所以子类不能继承父类的私有属性 print('Bar') b = Bar() b._Foo__func() ... 阅读全文
posted @ 2018-02-14 18:22 TAMAYURA 阅读(82) 评论(0) 推荐(0)