Question

I have a test tomorrow and I came across a question, to which I can't find the answer. I would really appreciate if you could answer me my question.

What is the base class for most stream classes?

Thank you.

Était-ce utile?

La solution

It depends on what they mean by "stream classes". If they mean the classes defined in <iostream>, <istream>, <ostream>, <fstream> and <sstream> (but not those in <streambuf>), then there are two "correct" answers: std::ios_base and std::basic_ios<>. The first is the base of the second, which factors out the parts which are not dependent on the instantiation type. On the other hand, as a user, you should probably think of the two as one common class, either std::basic_ios<char> or std::basic_ios<wchar_t>, depending on whether you are using narrow character streams or wide character streams.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top