On Fri, Jan 20, 2006 at 02:48:08AM +0900, James Hughes wrote: > Hi, > Let's say I have a third party module, Foo, with class Foo::Bar. I > have two classes, A and B, which inherit from Foo::Bar. And, I have a > set of class methods which need to be available to objects of class A > and B, and have access to all the class variables and methods from > Foo::Bar. > > What is the best way to incorporate the needed methods into this > hierarchy? Right now I've just hacked them into the source for the > third party lib that I'm working with, after trying various options > such as reopening Foo::Bar in A (this obviously broke when I needed to I don't understand why this would "obviously break" or what you mean by "in A". If you reopen Foo::Bar, and both A and B inherit from Foo::Bar, then modifications to Foo::Bar available to A should be available to B as well. > add class B), inserting another class into the hierarchy between Bar > and A and B, and probably some other ideas I've forgotten. > > I know there is probably a simple solution to this but my OOP muscles > don't seem to be flexing optimally. Can anyone give me a nudge in the > right direction? You can also create a mixin and extend Foo::Bar with the mixin. If you do this, instance methods in the mixin will be available as class methods in Foo::Bar and derived classes. Paul