-5
在我的教科书中,它说ifstream
是一个istream
从文件读取。后来下来的页面,旁边还有一个例子的评论:我不明白ifstream
ifstream ist(name.c_str()); // ist is an input stream for the file named name.
我有点困惑的区别是什么ifstream
和ist()
之间。
在我的教科书中,它说ifstream
是一个istream
从文件读取。后来下来的页面,旁边还有一个例子的评论:我不明白ifstream
ifstream ist(name.c_str()); // ist is an input stream for the file named name.
我有点困惑的区别是什么ifstream
和ist()
之间。
ist
是您将使用的ifstream
的实例。有一个类型 - ifstream
- 可以是许多变量的类型。
您可能有ist
,ist2
,ist3
,xpto
,它们全都是ifstream
。
ifstream
是类型。
'ifstream'是类型,'ist'是变量名。这是非常基本的东西。 – Rapptz
'std :: ifstream'是一个类,'ist'是该类的一个实例。 – 0x499602D2
我认为是变量名称。但他们的方式使它看起来像你不得不使用ist,我看到很多其他人使用它。这只是一个使用它的惯例吗? – UnworthyToast