标准IO库
2016-02-22 19:48
387 查看
#include <iostream> #include <fstream> #include <sstream> using namespace std; void print(ofstream &of) // 传参数只能传引用或指针, { cout << "test!" << endl; } //ofstream &print(ofstream &of) //{ // cout << "test!" << endl; // ofstream of2; // return of2; //} void foo(ostream &os) { cout << "test ostream" << endl; } //int main() //{ // foo(cout); // ofstream ofs;// 派生类是基类的地方都可以调用, // foo(ofs); // string oss; //多态, // //foo(oss); // 基类中的子类都是可以调用,子类就是派生类, // return 0; //} int main() { cout << "Hello C++ " << endl; fstream fs; // fstream是文件流对象, stringstream ss; ofstream out1, out2; // out1 = out2; //这是错误的, print(out1); return 0; }
相关文章推荐
- MillWheel: Fault-Tolerant Stream Processing at Internet Scale
- fiddler Android下https抓包全攻略
- Where 和Having的区别
- StrictMode 详解
- HTML常用标签
- linux文件命令
- c#学习——arraylist集合
- [CodeForces 602B]Approximating a Constant Range[构造]
- NodeJs module 的初步理解
- leetcode_001 two sum
- HDU1711-Number Sequence-KMP
- [转载]查找进程所有者函数
- 1098. Insertion or Heap Sort (25)
- 贪吃蛇的实现及其简单AI设计
- R语言dplyr简介
- 图解Nginx-Nginx进程模型1
- 【转载】点击率预估的几个经典模型简介
- GDKOI2016滚粗记
- 消息摘要 —— MD5算法
- python 环境搭建