1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
class Human(object): eye = "黑色" def jump(self): print("能上树") def __makebaby(self): print("能繁衍")
class son(Human): pass
obj = son() obj.jump()
class Father(): property ="才高八斗" def f_hobby(self): print("吃喝玩乐")
class Mother(): property = "貌美如花" def m_hobby(self): print("琴棋书画")
class Daughter(Father,Mother): pass
obj = Daughter() print(obj.property) obj.f_hobby()
class Father(): property ="才高八斗" def f_hobby(): print("吃喝玩乐")
class Mother(): property = "貌美如花" def m_hobby(): print("琴棋书画")
class Son(Father,Mother): def skill(self): Father.f_hobby() print(Mother.property) def skill2(self): print(super()) print(super().property) print(super().m_hobby())
obj2 = Son() obj2.skill() obj2.skill2()
|