File tree 1 file changed +19
-9
lines changed
1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change 2
2
-- while also using a table for input methods.
3
3
local class = require (' pl.class' )
4
4
5
+ -- From a plain table of methods
5
6
local A = class ({
7
+ info = " foo" ,
6
8
_init = function (self )
7
9
self .info = " A"
8
10
end
9
11
})
10
12
13
+ -- From a plain table of methods, inherit from a base
11
14
local B = class (A , nil , {
12
15
_init = function (self )
13
- self :super ()
16
+ print (" FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" )
17
+ -- self._base._init(self)
18
+ -- self:super()
14
19
self .info = self .info .. " B"
15
20
end
16
21
})
17
22
18
- local C = class (B , nil , {
19
- _init = function (self )
20
- self :super ()
21
- self .info = self .info .. " C"
22
- end
23
- })
23
+ -- -- From a base plus a plain table
24
+ -- local C = class(B, nil, {
25
+ -- -- local C = class({
26
+ -- -- _base = B,
27
+ -- _init = function(self)
28
+ -- -- self._base._init(self)
29
+ -- -- self:super()
30
+ -- self.info = self.info .. "C"
31
+ -- end
32
+ -- })
24
33
25
- local foo = C ()
26
- assert (foo .ino == " ABC" )
34
+ local foo = B ()
35
+ print (" DEBUG:" .. foo .info )
36
+ assert (foo .info == " AB" )
You can’t perform that action at this time.
0 commit comments