上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 32 下一页
摘要: ``` /* (非继承的类) 如果一个类中有虚函数,则该类就有一个虚函数表。虚函数表是属于类的,不属于类对象。在编译的时候确定,存放在只读数据段。 每一个实例化的类对象都有一个虚函数表指针,指向类的虚函数表。虚函数表指针属于类对象。存放在堆上或者栈上。 (继承的类) 如果基类中有虚函数,派生类实现或没实现,都有虚函数表。基类的虚函数表和派生类的虚函数表不是同一个表。 如果派生类没有重写基类的虚函数... 阅读全文
posted @ 2019-06-14 10:46 JohnRed 阅读(1947) 评论(0) 推荐(1)
摘要: 析构函数是虚函数的输出结果: 析构函数不是虚函数的输出结果: 阅读全文
posted @ 2019-06-13 21:00 JohnRed 阅读(1490) 评论(0) 推荐(0)
摘要: 将基类中的虚函数定义为public,在派生类中将该虚函数定义为private,则可以通过基类指针调用派生类的private函数 运行结果 阅读全文
posted @ 2019-06-13 11:02 JohnRed 阅读(1515) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2019-06-13 10:17 JohnRed 阅读(921) 评论(0) 推荐(0)
摘要: ``` 1 宏定义在预编译的时候进行字符串替换。内联函数在编译的时候进行函数展开。 2 宏定义没有类型检查。内联函数会进行参数列表、返回值等类型检查。 ``` 阅读全文
posted @ 2019-06-12 17:33 JohnRed 阅读(429) 评论(0) 推荐(0)
摘要: ``` include include include include include void SetCpuWhich() { int cpu_num=sysconf(_SC_NPROCESSORS_CONF); printf("[%s]cpu_num:%d\n",__FUNCTION__,cpu 阅读全文
posted @ 2019-06-11 14:20 JohnRed 阅读(778) 评论(0) 推荐(0)
摘要: ``` include include include include include include std::mutex iomutex; void thread_func(int num) { while(true) { sched_param sch; int policy; pthread 阅读全文
posted @ 2019-06-11 10:05 JohnRed 阅读(647) 评论(0) 推荐(0)
摘要: std::lock_guard std::unique_lock 阅读全文
posted @ 2019-05-31 16:42 JohnRed 阅读(618) 评论(0) 推荐(0)
摘要: ``` //vRecorder.hpp //vov ifndef V_RECORDER_HPP define V_RECORDER_HPP include include include include include include include "Recorder.h" include "vB 阅读全文
posted @ 2019-05-30 11:21 JohnRed 阅读(636) 评论(0) 推荐(0)
摘要: ``` //vbuffer_char.hpp //vov #ifndef V_BUFFER_CHAR_HPP #define V_BUFFER_CHAR_HPP #include #include #include #define BUFFER_CAPACITY (16000) class vBufferChar { std::vector buffer_; int ... 阅读全文
posted @ 2019-05-29 17:53 JohnRed 阅读(310) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 32 下一页