From: John Carter Date: 2005-12-06T11:54:47+09:00 Subject: Re: Subclassing Class. On Tue, 6 Dec 2005, Aredridel wrote: > class Foo > def self.new(needs_fu, stuff) # Could be Foo.new, too, but self keeps > us warm and DRY. > super(foo_fu(needs_fu), @foo_state, stuff) > end > end > Each Class (and indeed, every other object) has its own private class, > for just that object alone, the eigenclass. It can have methods added to > with the def instance.method syntax -- self.new, in this case, or > Foo.new would work just as well -- and so, Foo.new is different than > another class's new method. Since it's a "virtual" child class of Class, > it works as you'd expect with regards to super. Err. Right. On to the next step. Let's rename Foo to AbstractFoo Now I wanted class AbstractFoo < Class end and you have given me that. But that was merely the first step in my agenda. I actually also want.... class ConcreteFooClass < AbstractFooClass end class OtherConcreteFooClass < AbstractFooClass end that polymorphically inherits behaviour from AbstractFooClass. I'm starting to really hate the Builder, Factory, AbstractFactory, FactoryMethod names. They are not explicit enough to distinguish which is what from the name, and the web seems to pretty confused on the subject as well. Anyhoo, factory method pattern is what trying to do. John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand Carter's Clarification of Murphy's Law. "Things only ever go right so that they may go more spectacularly wrong later." From this principle, all of life and physics may be deduced.