문제

I have always had this doubt about namespace std. My conclusion is that all class and function declarations in the standard header files shipped with the compiler(g++) are actually inside a namespace called 'std'. So each time the developer made a new header file they would start of like

Namespace std {

Am I right ?

Is ios::in a variable inside the ios namespace or is ios a class and 'in' a static variable of some type ? If yes, does it have an integer value of some kind that instructs the open member function to open a file to be read ?

What do you mean by an ios flag ?

도움이 되었습니까?

해결책

The use of namespace std for all identifiers of th C++ standard library was introduced during the standardization process. So saying that namespace std holds all the class shipped with the compiler is correct.Backward compatible is also provided by including C header files. (example #include )

ios class is derived from ios_base class which has opening mode flag eg. in,out etc.

These stream opening mode flag are static const public member of ios_base class and can be directly accessed by calling their names as ios_base::in or by the class derived from ios_base class. ios class is derived from ios_base so stream opening flag can be accessed as ios::in.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top