inheritance problem
gabor
gabor at realtime.sk
Tue Oct 1 12:43:32 EDT 2002
More information about the Python-list mailing list
Tue Oct 1 12:43:32 EDT 2002
- Previous message (by thread): inheritance problem
- Next message (by thread): inheritance problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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"
- Previous message (by thread): inheritance problem
- Next message (by thread): inheritance problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list