Skip to content

Instantly share code, notes, and snippets.

@colm-mchugh
Last active May 10, 2017 03:59
Show Gist options
  • Save colm-mchugh/9b683078eddc20656af23b78132dfff4 to your computer and use it in GitHub Desktop.
Save colm-mchugh/9b683078eddc20656af23b78132dfff4 to your computer and use it in GitHub Desktop.
Plemm questionnaire
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