Skip to content

Instantly share code, notes, and snippets.

@JEG2
Created March 8, 2011 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JEG2/860817 to your computer and use it in GitHub Desktop.
Save JEG2/860817 to your computer and use it in GitHub Desktop.
class Rectangle
def initialize(width, height)
@width = width
@height = height
end
def area
@width * @height
end
end
class Square < Rectangle
def initialize(side_length)
super(side_length, side_length)
end
end
p Square.new(4).area
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment