摘要: class H: def bar(self): print("h bar") class G(H): def bar(self): print("g bar") class F(H): def bar(self): print("f bar") class E(G): def bar(self): ... 阅读全文
posted @ 2019-03-25 21:08 杨fj 阅读(134) 评论(0) 推荐(0)
摘要: # # # # 类方法 # # # class A: # # # def func(self): # 普通方法 # # # print(self) # # # # # # @classmethod # 类方法 # # # def func1(cls): # # # print(cls) # # # a = A() # # # a.f... 阅读全文
posted @ 2019-03-25 12:05 杨fj 阅读(116) 评论(0) 推荐(0)
摘要: # 属性初识 # class Bmi: # def __init__(self, name, weight, height): # self.weight = weight # self.name = name # self.height = height # # @property # 将一个方法伪装成属性,在代码本质上没有什... 阅读全文
posted @ 2019-03-25 11:02 杨fj 阅读(90) 评论(0) 推荐(0)
摘要: # # # # python 面向对象的三大特征之一 # # # # python多态:python中处处都是多态 python是一种弱类型的语言 # # # # java 是强类型语言 # # # # 比如:python中 name = "qq", java中 int_i = 666 如果之间直接改变类型。python可以直接改变,java则会报错 # # # # # # # pytho... 阅读全文
posted @ 2019-03-25 00:23 杨fj 阅读(80) 评论(0) 推荐(0)