Quoteing davegaramond / icqmail.com, on Mon, Jan 20, 2003 at 10:00:51PM +0900:
> i want to have a class that can support multiple sets of methods, based 
> on what the client requests. so far i have written the following python 
> code. it's ugly/not elegant and i haven't managed to come up with a less 
> ugly ruby version :-)

I'm just learning Ruby, but what about the really simple:

class C
   
   class Ca
     def foo
       ...
     end
   end

   class Cb
     def foo
       ...
     end
   end

   def foo
     @facet.foo
   end

   def initialize(type)
     if(type)
       @facet = Va.new
     else
       @facet = Vb.new
   end

end


Completely untested, but that's what I'd do in C++. Granted C::Ca#foo
isn't really a method of C, so it can't access instance variables of C,
but you could simulate this by having C#foo pass self as an arg to
@facet.foo.

Is this somehow fundamentally bad?

Sam