mình học đến bài 44 ở quyển learnpythonthehardway
và mình test đoạn code:
class Parent(object):
def print_out(self):
print "PARENT!"
class Child(object):
def print_out(self):
print "CHILD!"
class SuperFun(Child, Parent):
def print_out(self):
super(SuperFun, self).print_out()
s = SuperFun()
s.print_out()
kết quả:
CHILD!
class SuperFun kế thừa 2 class Child và Parent
mình muốn hỏi là sau khi dùng phương thức super(...)
thí khi dùng s.print_out()
nó sẽ gọi đến print_out()
của class đứng trước trong khai báo class SuperFun(Child, Parent)
. Ở đây là Child
vậy mình muốn gọi đến cái print_out()
của Parent
thì làm thế nào