Penlight - Calling the constructor of a parent class
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Penlight - Calling the constructor of a parent class
- From: Luciano de Souza <luchyanus@...>
- Date: 2013年1月03日 02:26:27 -0200
Hello listers,
I have tried some inheritance with Penlight class support. However, I
don't know how to call the parent constructor. This code fails, so I
ask: what is wrong:
class = require('pl.class')
class.control()
function control:_init(title)
self.title = title
end
class.window(control)
function window:_init(title)
control:_init(title)
end
function window:show()
print(self.title)
end
window = window('Hello World')
window:show()