ObjectA calling ObjectB
Lawrence Oluyede
raims at dot.com
Sat Dec 27 16:42:21 EST 2003
MidasOneTwo at hotmail.nospam.com (Midas) writes:
> Thanks for replying. It looks like you hardcoded the name ObjectB
> within ClassA. I'd like to avoid all hardcoding of names. In other
> words, I'd like ObjectA to be *told*, at run time, which object to call
> and which method to call.
Mmm what do you mean with "to be told, at run time, which object
to call and which method to call" ?
Something like:
if var == "a":
# create object a and call method x
else:
# create object c and call method y
?
--
Lawrence "Rhymes" Oluyede
http://loluyede.blogspot.com
More information about the Python-list
mailing list