[Tutor] Re: How do you share a method (function) among several objects?

Javier Ruere javier at ruere.com.ar
Sun Feb 27 18:46:35 CET 2005


Xif wrote:
> Hello
> 
> There are several different objects. However, they all share the same
> function.
> 
> Since they are not the same or similar, it's not logical to use a
> common superclass.
> 
> So I'm asking, what's a good way to allow those objects to share that
> function?
> 
> The best solution I've found so far is to put that function in a
> module, and have all objects import and use it. But I doubt that's a
> good use-case for modules; writing and importing a module that contains
> just a single function seems like an abuse.
> 
> Thanks,
> Xif

   Could you give an example?

Javier



More information about the Tutor mailing list