Last active
May 10, 2017 03:59
-
-
Save colm-mchugh/9b683078eddc20656af23b78132dfff4 to your computer and use it in GitHub Desktop.
Plemm questionnaire
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 A | |
attr_accessor :x | |
def initialize() | |
@x = 3 | |
end | |
def f() | |
@x | |
end | |
def g() | |
@x + f() | |
end | |
end | |
class B < A | |
attr_accessor :x | |
def initialize() | |
super() | |
@x = 30 | |
end | |
def f() | |
@x | |
end | |
end | |
class C < B | |
attr_accessor :x | |
def initialize() | |
super() | |
@x = 300 | |
end | |
def g() | |
@x + f() | |
end | |
end | |
foo = C.new | |
foo.x | |
foo.f() | |
foo.g() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment