Skip to content

Instantly share code, notes, and snippets.

@rstacruz
Created April 30, 2010 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rstacruz/385110 to your computer and use it in GitHub Desktop.
Save rstacruz/385110 to your computer and use it in GitHub Desktop.
class Shape
def self.desc(str)
@@description = str
end
def self.description
@@description
end
end
class Circle < Shape
desc "A round shape"
end
class Square < Shape
desc "A quadrilateral"
end
puts Circle.description
puts Square.description
# Actual output:
# A quadrilateral
# A quadrilateral
# Expected:
# A round shape
# A quadrilateral
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment