Created
February 27, 2014 18:58
-
-
Save zeldani/9256685 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A: | |
def __init__(self, a, b): | |
self.a, self.b = a, b | |
def conta(self, x): | |
return self.a*x+self.b | |
class B: | |
def __init__(self, texto): | |
self.texto = texto | |
def escreve(self, valor): | |
print self.texto,'=', valor | |
class C(A, B): | |
def __init__(self, texto, a, b): | |
A.__init__(self, a, b) | |
B.__init__(self, texto) | |
def escreve(self, x): | |
B.escreve(self, self.conta(x)) | |
c = C("total", 3, 5) | |
print c.escreve(7) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment