Skip to content

Instantly share code, notes, and snippets.

@zeldani
Created February 27, 2014 18:58
Show Gist options
  • Save zeldani/9256685 to your computer and use it in GitHub Desktop.
Save zeldani/9256685 to your computer and use it in GitHub Desktop.
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