I got a Base
superclass and a bunch of derived classes, like Base::Number
, Base::Color
. I'd like to be able to use those child classes as if I they inherited from say Fixnum
in the case of Number
.
What's the best way to do this, while still having them respond appropriately to is_a? Base
?
So, I should be able to do
Number.new(5) + Number.new(6) # => 11
Number.new.is_a? Base # => true
I'm thinking I could mix-in Base, and overwrite the is_a?, kind_of? and instance_of? methods, but hopefully there's a cleaner way.