-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchild.lua
More file actions
48 lines (38 loc) · 812 Bytes
/
Copy pathchild.lua
File metadata and controls
48 lines (38 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
-----------------------------------------------------------------------------------------
--
-- Child.lua
--
-----------------------------------------------------------------------------------------
require ("luoop")
--- Constructor ---
local function new(self, sColor)
-- Assigning a color
self:_setColor(sColor)
end
--- Class Definition ---
Child = class(new)
--- Destructor ---
function Child:destroy()
self:_setColor(nil)
end
--- Getters / Setters ---
-- Privates
function Child:_getColor()
return self._sColor
end
function Child:_setColor(sColor)
self._sColor = sColor
end
-- Public
function Child:getColor()
return self:_getColor()
end
function Child:setColor(sColor)
self:_setColor(sColor)
end
function Child:type()
return 'Child'
end
function Child:toString()
return 'I am a child'
end