上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 66 下一页
摘要: class A { public: virtual void f();//希望派生类重写 void fun();//绝大多数情况下不要重新定义基类的非虚函数,那样会打破公有继承Is-A的关系,而且行为诡异 }; class B : public A { }; int main() { A a; return 0; } 阅读全文
posted @ 2016-10-07 19:04 zzyoucan 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 发现还有好多c++很基础的细节问题,在写代码的时候时常困扰自己,有时间需要研究一下 阅读全文
posted @ 2016-10-07 10:58 zzyoucan 阅读(175) 评论(0) 推荐(0) 编辑
摘要: extern "C"{ #include #include #include } #include #include #include #pragma comment(lib,"lua.lib") void error(lua_State* L, const char* fmt, ...) { va_list argp; va_start(argp, fmt); ... 阅读全文
posted @ 2016-10-06 09:59 zzyoucan 阅读(330) 评论(0) 推荐(0) 编辑
摘要: //顶 -1 -2 -3 //顶 3 2 1 #include #include extern "C"{ #include #include #include } #pragma comment(lib,"lua.lib") void stackDump(lua_State* L) { int i; int top = lua_gett... 阅读全文
posted @ 2016-09-30 00:49 zzyoucan 阅读(510) 评论(0) 推荐(0) 编辑
摘要: #include #include extern "C"{ #include #include #include } #pragma comment(lib,"lua.lib") int main() { char buff[256]; int error; lua_State* L = luaL_newstate(); lua... 阅读全文
posted @ 2016-09-28 00:09 zzyoucan 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Window = {} Window.prototype = {x = 0, y = 0, width = 70, height = 100} Window.mt = {} function Window.new(o) setmetatable(o, Window.mt) return o end --[[Window.mt.__index = function (table... 阅读全文
posted @ 2016-09-24 22:06 zzyoucan 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Set = {} Set.mt = {} function Set.new(t) local set = {} setmetatable(set, Set.mt) for _, l in ipairs(t) do set[l] = true end return set end function Set.union(a, b) local res = S... 阅读全文
posted @ 2016-09-24 00:33 zzyoucan 阅读(186) 评论(0) 推荐(0) 编辑
摘要: function list_iter(t) local i = 0 local n = table.getn(t) return function() i = i + 1 if i <= n then return t[i] end end end t = {10, 20, 30} iter = list_iter(t) whil... 阅读全文
posted @ 2016-09-21 00:01 zzyoucan 阅读(217) 评论(0) 推荐(0) 编辑
摘要: --匿名函数使用upvalue i保存他的计数, 闭包是一个函数加上它可以正确访问的upvalues function newCounter() local i = 0 return function() i = i + 1 return i end end c1 = newCounter() print(c1()) print(c1()... 阅读全文
posted @ 2016-09-19 00:05 zzyoucan 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 好长时间没有写了,其实一直在坚持学习。 阅读全文
posted @ 2016-08-27 23:38 zzyoucan 阅读(1545) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 66 下一页