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

Mike xcentric at unixgeek.net
Thu Jul 1 07:09:30 EDT 2004


I named the class object just as an example. In a real world case I wouldn't use that name.

And your right... my mistake is because I was up too late and should have been a sleep. Thanks

~Mike

On Thu, 2004-07-01 at 03:45, Alan Gauld wrote:

> 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