[Tutor] subclass / superclass methods (original) (raw)

Alan Gauld alan.gauld at blueyonder.co.uk
Thu Jul 1 03:45:38 EDT 2004


I'm trying to find out why the below does not work as I'm expecting. I'm sure there is a good answer, just I'm too green to understand why. Any help would be appreciated. My expected results are for it to say 'Hello other OnTick'

First, its a bad oidea to create a class called object, since that will hide the builtin class called object which could produce weird results!

class object: def init(self): def EventTick(self): print 'Hello object EventTick' self.OnTick() def OnTick(self):

class other(object): def init(self): def OnEvent(self):

You have an OnTick() in object but an OnEvent() in other. I suspect you meant to have an OnTick() in both?

Alan G.



More information about the Tutor mailing list