glenn wrote: > Hi Roberto > >>If you want dog.voice() to just print "voice: bark", you just have to omit >>the voice method for the dog class: it will be inherited from creature. >> > > I would have thought this would be correct, but in this case, plus in > others im playin with, I get this issue: > ----------------------- > given animal.py is: > class creature: > def __init__(self): > self.noise="" > def voice(self): > return "voice:" + self.noise > > class dog(creature): > def __init__(self): > self.noise="bark" > > then I get this outcome... > >>>>import animal >>>>beagle=animal.dog [...]
Shouldn't that be beagle = animal.dog() to create an instance? We've all done it ... regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list