转载自:http://blog.csdn.net/ganpengjin1/article/details/45892225
table_Base = {}
function table_Base.getValue()
return -1;
end
function table_Base.newObject(o)
o = o or {};
setmetatable(o, self);
o.__index = self;
return o;
end
function table_Base.Name()
print("table A");
end
objectB = table_Base:newObject();
objectB.Name();
function objectB.Name()
print("table B")
end
s = objectB:newObject();
s.Name();
print(s.getValue());
--输出结果
--table A
--table B
---1