Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Sep 29, 2020
1 parent b06b02f commit 420f828
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions tests/test-class5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,35 @@
-- while also using a table for input methods.
local class = require('pl.class')

-- From a plain table of methods
local A = class({
info = "foo",
_init = function (self)
self.info = "A"
end
})

-- From a plain table of methods, inherit from a base
local B = class(A, nil, {
_init = function(self)
self:super()
print("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")
-- self._base._init(self)
-- self:super()
self.info = self.info .. "B"
end
})

local C = class(B, nil, {
_init = function(self)
self:super()
self.info = self.info .. "C"
end
})
-- -- From a base plus a plain table
-- local C = class(B, nil, {
-- -- local C = class({
-- -- _base = B,
-- _init = function(self)
-- -- self._base._init(self)
-- -- self:super()
-- self.info = self.info .. "C"
-- end
-- })

local foo = C()
assert(foo.ino == "ABC")
local foo = B()
print("DEBUG:"..foo.info)
assert(foo.info == "AB")

0 comments on commit 420f828

Please sign in to comment.