The great thing about Ruby is that you don't need to use inheritance just to provide a contract for implemented methods. Instead, you could do this:
class Square
def initialize(side)
@side = side
end
def area
@side * @side
end
end
class Circle
def initialize(radius)
@radius = radius
end
def area
@radius * @radius * 3.14159
end
end
shapeArea(Square.new(2))
shapeArea(Circle.new(5))
, . twod ( Ruby , twod ), .