inheritance problem
gabor
gabor at realtime.sk
Tue Oct 1 12:43:32 EDT 2002
i modified a bit your example, see it below...
objlist = {}
def callback_a(id):
obj = objlist[id]
obj.a()
class A( object ):
__init__(self):
id = registerSomeWhere()
objlist[id]=self
def a( self ):
return self.b()
def b( self ):
return 'A'
class C( A ):
def __init(self):
A.init()
def b( self ):
return super(C,self).b()+'C'
=============
and now the caller code:
obj = C() #internally A's initializer gets the id "the_id"
and from somewhere:
callback_a("the_id")
and it calls A.b and i want C.b
i hope this makes it clearer :-)
thanks,
gabor
--
That's life for you, said McDunn. Someone always waiting for someone
who never comes home. Always someone loving something more than that
thing loves them. And after awhile you want to destroy whatever
that thing is, so it can't hurt you no more.
-- R. Bradbury, "The Fog Horn"
More information about the Python-list
mailing list