Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Person = require("Person") -- See: https://pastebin.com/DugLGsyg
- local Doctor = setmetatable({}, {__index = Person})
- Doctor.__index = Doctor
- function Doctor.new(gender, name, field)
- local self = setmetatable(Person.new(gender, name), Doctor)
- self.field = field
- return self
- end
- function Doctor:greet()
- self:speak("Hello, I am Dr. " .. self.name)
- end
- function Doctor:heal(person)
- person.health = person.health + 10
- self:speak("Good thing you're not American or this would cost a fortune!")
- person:speak("Gee, thanks!")
- end
- return Doctor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement