Files
cs-252/lab19/method-missing.rb
2026-04-29 11:33:23 -07:00

22 lines
302 B
Ruby

class Person
attr_accessor :name
def initialize(name)
@name = name
end
def make_introduction
puts "Hi, my name is #{@name}. Nice to meet you."
end
def method_missing(m)
puts "Didn't understand #{m}"
end
end
alice = Person.new('Alice')
alice.make_introduction
alice.foo