Ozzypig

Doctor Class

May 10th, 2018
295
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Person = require("Person") -- See: https://pastebin.com/DugLGsyg
  2. local Doctor = setmetatable({}, {__index = Person})
  3. Doctor.__index = Doctor
  4.  
  5. function Doctor.new(gender, name, field)
  6.     local self = setmetatable(Person.new(gender, name), Doctor)
  7.     self.field = field
  8.     return self
  9. end
  10.  
  11. function Doctor:greet()
  12.     self:speak("Hello, I am Dr. " .. self.name)
  13. end
  14.  
  15. function Doctor:heal(person)
  16.     person.health = person.health + 10
  17.     self:speak("Good thing you're not American or this would cost a fortune!")
  18.     person:speak("Gee, thanks!")
  19. end
  20.  
  21. return Doctor
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×