[Tutor] Re: Method/subclass
Wolfram Kraus
kraus at hagen-partner.de
Tue Feb 22 11:14:46 CET 2005
Liam Clarke wrote:
> Hi all,
>
>
> I'm working on my first object-based-from-the-ground-up project, and I
> have some queries.
>
> http://www.rafb.net/paste/results/lDUmWS78.html
>
> Here are my two classes here. For each different function, search,
> edit, view, etc. a different SQL operation will take place, and a
> different child window will be returned to the main window.
> Roughly speaking.
>
> I was going to create a method for each of the different functions in
> both class, but I was wondering if it would be better to subclass for
> each function. I've never done this before, so it's a little
> confusing.
>
> Incidentally, is this
>
> searchWin = genericChild
>
> an OK way to create a class instance of genericChild? It seems to work
> OK, and Pythoncard does funny things with __init__ for windows ( I
> can't figure out how to pass __init__ arguments for example.)
>
> But I'm worried that there's some unforeseen consequence of this kind
> of thing, it just seems strange not finishing with ().
>
> So yeah, should I do a method for each function, or subclass my generic classes?
>
> Regards,
>
> Liam Clarke
>
I didn't look at the rest of the code, but you want
searchWin = genericChild()
instead. (Do a print searchWin to see why ;-))
HTH,
Wolfram
More information about the Tutor
mailing list