From: Rolf Gebauer Date: 2007-02-07T01:20:11+09:00 Subject: Re: Inheriting from Fixnum On 3 Feb., 09:07, "gga" wrote: > Now... this should be simple, but, alas, it is not. > I'm creating some special numeric classes, and I wanted to derive from > Fixnum, for example. > > class Frame < Fixnum > end > > While the above code works, doing then: > > Frame.new(20) > > will fail As I' have learned from this thread, you can't inherit from Fixnum ! But maybe You can get along with Rational and its non private method ! new require 'rational' class Frame < Rational end f1 = F.new!(99) f2 = F.new!66) puts f2 - f1 # 33 Rolf Gebauer