From: Stephen White Date: 2001-04-24T07:40:57+09:00 Subject: [ruby-talk:14113] Re: RCR: getClassFromString method On Tue, 24 Apr 2001, Phil Tomson wrote: > class Tool > #methods to handle generic stuff common to PC and UNIX > end > > class Tool_PC < Tool > #methods do PC specific stuff > end > > class Tool_UNIX < Tool > #methods do UNIX related stuff > end What about arranging it like this: class Tool_Generic #methods to handle generic stuff common to PC and UNIX end class Tool_PC < Tool_Generic #methods do PC specific stuff end class Tool_UNIX < Tool_Generic #methods do UNIX related stuff end if $PLATFORM == "PC" class Tool < Tool_PC end else class Tool < Tool_UNIX end end then you could just use class Tool. (the syntax would be completely wrong as I haven't played around with building up classes out of other classes. Any corrections welcome as I would be interested in seeing how to do this). -- spwhite@chariot.net.au