Title / Description
Code 1 class("mutter") 2 3 function mutter.new(name) 4 return {name = name} 5 end 6 7 function mutter:print() 8 print("Ausgabe: " .. self.name 9 end 10 11 class("kind", mutter) 12 13 function kind.new(name, alter) 14 return {name = name, alter = alter} 15 end 16 17 function kind:print() 18 print("Ausgabe: " .. self.name .. " (" .. tostring(self.alter) .. ")") 19 end 20 21 a = mutter("Mama") 22 b = kind("Tochter", 5) 23 24 a:print() 25 b:print()
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code