Skip to content

Instantly share code, notes, and snippets.

Created August 19, 2015 00:58
Show Gist options
  • Save anonymous/0a32e2b0195c01316b10 to your computer and use it in GitHub Desktop.
Save anonymous/0a32e2b0195c01316b10 to your computer and use it in GitHub Desktop.
class Parent
def initialize(name)
@name = name
@phone = build_phone_number
end
def build_phone_number
raise 'Subclasses must override build_phone_number method!'
end
end
class Child < Parent
def initialize()
super("Tom Bombadil")
end
def build_phone_number
"1234567890"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment