Created
August 19, 2015 00:58
-
-
Save anonymous/0a32e2b0195c01316b10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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