Skip to content

Instantly share code, notes, and snippets.

@notahat
Created May 6, 2010 01:39
Show Gist options
  • Select an option

  • Save notahat/391685 to your computer and use it in GitHub Desktop.

Select an option

Save notahat/391685 to your computer and use it in GitHub Desktop.
class A
def hello
"A#hello"
end
def method_missing(method, *args)
"A#method_missing"
end
protected :hello
end
p A.new.hello # => "A#method_missing"
@DanielHeath
Copy link

And also

A.new.hello
=> "A#hello"

Right, so you can hide functionality in a subclass that is provided by the superclass.
That sounds like a bad idea, since it sort of stops you being able to rely on object-oriented polymorphism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment