lab19: init

This commit is contained in:
2026-04-29 11:33:23 -07:00
parent d042a0e016
commit dba2c2b3d6
12 changed files with 386 additions and 0 deletions

21
lab19/method-missing.rb Normal file
View File

@@ -0,0 +1,21 @@
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