摘要:
--lua仿单继承Account = { balance = 0}function Account:new(o) o = o or {} setmetatable(o, self)--Account表本身作为o的metatable self.__index = self--自己作为自己的原型 ... 阅读全文
posted @ 2015-03-10 13:35
zzyoucan
阅读(189)
评论(0)
推荐(0)
摘要:
Account = { balance = 0}function Account:deposit(v) self.balance = self.balance + vendfunction Account:new(o) o = o or {} setmetatable(o, self)--A... 阅读全文
posted @ 2015-03-10 10:56
zzyoucan
阅读(141)
评论(0)
推荐(0)
摘要:
Account ={ balance = 0, withdraw = function(self, v) self.balance = self.balance - v end}--:操作符隐藏了self或者this参数,操作方便function Account:deposit(v) ... 阅读全文
posted @ 2015-03-10 00:39
zzyoucan
阅读(143)
评论(0)
推荐(0)

浙公网安备 33010602011771号