摘要: 缘起#include #include #include using namespace std; int main(){ ofstream fs; //输出文件流 (正确) ostringstream os; //输出string流(正确) ostream o; //输出普通流 (错误)}解惑头文件iostream定义了三个类iostream, istream, ostream(三个普通流), 都存在这样的问题:不可以直接定义无参数的对象。原因可以从编译器提示看出 类中无参数的构造函数定义为protected,因此不可直接... 阅读全文
posted @ 2013-12-06 23:14 jihite 阅读(1108) 评论(0) 推荐(0)
摘要: 第4章96页,数组维数为变量第8章246. IO对象不可复制、赋值原因是类设计时复制构造函数、赋值函数是私有的,为什么这么设计呢?251. tie举例第15章484 派生类可以恢复,但不可扩大#include #include using namespace std;class base{ public: base(int p1=1, int p2=2, int p3=3) : pub(p1), pri(p2), pro(p3) {} int pub; private: int pri; protected: int p... 阅读全文
posted @ 2013-12-06 22:13 jihite 阅读(296) 评论(0) 推荐(0)