class Pouet: def __init__(self, foo=0, bar=0): self.foo = foo if foo >= 0: self.bar = bar else: self.bar = -bar def __str__(self): return "foo: %s, bar: %s" % (self.foo, self.bar) def __add__(self, other): n = Pouet() n.bar = self.bar + other.bar n.foo = self.foo + other.foo return n def toto(self): print self.bar class Bik(Pouet): specific = 1 class Bok(Pouet): specific = 2 def __str__(self): return "Bonjour, je suis Bok"