摘要:
#include class cx { public: virtual void func() { std::cout func(); //cb.func } 阅读全文
posted @ 2019-12-07 21:51
时空观察者9号
阅读(596)
评论(0)
推荐(0)
摘要:
1,限制类的对象只能生成在栈上 将 operator new 各种原型设为私有 2,限制类的对象只能生成在堆上,有两种方法 2.1 使用单例模式:构造函数私有,getInstance()中获取单例时new 出来一个 2.2 析构函数私有,这样编译器就会自动阻止你定义栈上对象,析构函数私有了就需要类提 阅读全文
posted @ 2019-12-07 21:41
时空观察者9号
阅读(452)
评论(0)
推荐(0)
摘要:
原文链接:http://www.cnblogs.com/qianye/archive/2012/11/29/2794533.html 找中位数最容易想到的方法就是,先对序列进行排序,取中位数,然而5亿个数要想全部读入内存需要将近2GB空间。 一种想法是采用外部排序的方法,在排序的过程中记录数据个数, 阅读全文
posted @ 2019-12-07 21:28
时空观察者9号
阅读(355)
评论(0)
推荐(0)
摘要:
#include <iostream> int main() { int d2a[3][4] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; //输出 0,1,2,3,4,5,6,7,8,9,10,11 for (size_t i = 0; i < 3; i++) { for (size_t j = 0; j < 4; j++) { std::cout << 阅读全文
posted @ 2019-12-07 18:42
时空观察者9号
阅读(257)
评论(0)
推荐(0)