Created
August 7, 2014 14:31
-
-
Save iblue/b19246866d973437eaa9 to your computer and use it in GitHub Desktop.
Interview Question :>
This file contains hidden or 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
# NoMethodError: undefined method `attr_reader' for User:Class | |
# | |
# Why? | |
class User | |
def initialize(name) | |
@name = name | |
end | |
def hello | |
puts "Hello, my name is #{name}" | |
end | |
attr_reader :name | |
end | |
user = User.new("John") | |
user.hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment