A superclass using a child classes' methods

Kurt Schwehr schwehr at gmail.com
Wed Jun 24 12:37:11 EDT 2009


Jean-Michel,

Thanks for the excellent response setting me straight.  Now to figure
out what dumb thing I did to make my code not work...

-kurt

On Jun 24, 12:23 pm, Jean-Michel Pichavant <jeanmic... at sequans.com>
wrote:
> Kurt Schwehr wrote:
> > I'm trying to build an OO system for encoding and decoding
> > datapackets.  I'd like the parent class to have an encode function
> > that uses each of the child classes' packing methods.  It appears that
> > this works for attributes of children accessed by the parent, but not
> > for methods.
>

[clear example of it working]

>
> Declaring the foo method at the Parent level is not required. But it's a
> good practice: explicit > implicit and it helps to write proper
> documentation.
>
> Jean-Michel




More information about the Python-list mailing list