OOP - Is this right or is it a bug ?

Rony rony.steelandt at bucodi.com
Tue May 20 03:14:26 EDT 2003


Not specialised in OOP, but learning, i discovered something by coinsidence
If you do

Class A:
   def foo(self):
      print 'in A'

Class B:
   def foo(self):
      print 'in B'

Then you do

Class C(A,B):
   def other(self):
      nop

m=C()
print m.foo()

You get 'in A'

I tought you would get 'in B' since you first heritate from A and the from B

I suppose i miss something here ?
Can somebody explain to me ?

Thanks,

Rony Steelandt




More information about the Python-list mailing list