On Friday, 13 December 2002 at 9:48:15 +0900, ahoward wrote: > On Fri, 13 Dec 2002, Gavin Sinclair wrote: > > i *think* i was advocating this (self.class.new) as a general library > practice... > I think the following would work, but I need a clean way to wrap all the public methods for Matrix. For some reason I was having trouble getting the right result, so I made a test case with the classes A and B. Both are show below. require 'matrix' class A private_class_method :new def self.[]; new end def inv; [] end end class B < A def inv super self end end class M < Matrix def inv super self end def to_f super self end end m = M[[1,2],[3,4]] puts m.inv.class puts m.to_f.class b = B[] puts b.inv.class === output M M B -- Jim Freeze ---------- "Life is like a buffet; it's not good but there's plenty of it."