update from Atlas

This commit is contained in:
Luciano Ramalho
2015-04-05 12:07:28 -03:00
parent cf96836b60
commit bdccc3269a
25 changed files with 394 additions and 47 deletions

27
12-inheritance/diamond.py Normal file
View File

@@ -0,0 +1,27 @@
class A:
def ping(self):
print('ping:', self)
class B(A):
def pong(self):
print('pong:', self)
class C(A):
def pong(self):
print('PONG:', self)
class D(B, C):
def ping(self):
super().ping()
print('post-ping:', self)
def pingpong(self):
self.ping()
super().ping()
self.pong()
super().pong()
C.pong(self)