在图中,streambuf类和ios类没有继承关系,它们是组合使用的,streambuf对象作为ios类的成员出现。事实上,ios类提供编程界面和格式特征,而streambuf做实质性的工作。
iostream类库中,streambuf、ios、istream、ostream、iostream、istream_withassign和ostream_withassign这些基本I/O流类和预定义的cin、cout、cerr和clog在iostream.h文件中说明。
filebuf、ifstream、ofstream和fstream在fstream.h中说明。
strstream、istrstream、ostrstream和strstream在strstrea.h中说明。
需要注意的是:fstream.h和strstrea.h中都包含了iostream.h,所以如果使用标准输入输出(控制台I/O),只要包含iostream.h头文件即可,如果使用fstream或者strstream,只要包含相应的fstream.h和strstrea.h即可。
标准输入输出流 类继承关系
最新推荐文章于 2024-01-25 11:42:16 发布