20 lines
300 B
Lua
20 lines
300 B
Lua
oop = require("oop/oop")
|
|
|
|
function Animal(cls)
|
|
function cls.speak(this)
|
|
print("animal")
|
|
end
|
|
end
|
|
|
|
function Dog(cls)
|
|
cls.inherit(Animal)
|
|
|
|
function cls.speak(this)
|
|
cls.super.speak(this)
|
|
print("woof")
|
|
end
|
|
end
|
|
|
|
local d = new(Dog)
|
|
d.speak() -- animal, then woof
|