注册 登录
编程论坛 C++教室

包含类声明的头文件可以不行iostream?

mehere 发布于 2008-08-20 22:12, 972 次点击
//student.h(头文件,其中进行类的声明
#include<string>       //为什么没有<iostream>
using namespace std.
class Student
  {public:void display();
   private:
      int num;string name;
   };


为什么没有<iostream>
???
4 回复
#2
忘记喧嚣2008-08-20 23:51
每个头文件的作用不一样
你要用到<iostream> 里面的东西才包含他三

比如你要用到 cout cin 这些.你的这个文件又没用到
包含来做什么?
#3
mehere2008-08-21 22:09
这么回事
谢谢
顺便问问  iostream是不是只有输入输出流啊?
#4
elegant872008-08-21 22:23
可以的!iostream只对输入输出的操作的!
#5
mehere2008-08-23 22:08
thanks very much
1