Classes, virtual methods ?

Rony rony.steelandt at bucodi.com
Fri May 16 04:04:45 EDT 2003


if you have :

Class A:
   def foo():
       print "in class A"
Class B(A):
   def foo()
       print "in class B"

m = B()
print m.foo()

You get 'in class B'

Now my question

Is there a way of calling foo of the master class of B with an instance of B
I think this is called virtual methods ?
Something like (in another language)
print m::A:foo()
wich would give 'in class A'

Thanks

Rony Steelandt




More information about the Python-list mailing list