在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
MyClass = { m_N = 0 } function MyClass:create() local o = {} setmetatable( o ,self) self.__index=self return o end function MyClass:SetN(n) self.m_N = n end SubClass = MyClass:create() SubClass.m_B = 30 function SubClass:SetN(n) self.m_N = n*2 self.m_B = n*2 end local a = MyClass:create() a:SetN(10) print(a.m_N) local b = SubClass:create() b:SetN(10) print(b.m_N) print(b.m_B) local c = SubClass:create() c:SetN(40) print(c.m_N) print(c.m_B)
|
请发表评论