'Modes in fstream referring to two different sets ios and fstream for the same thing(in my opinion)
What is the difference between these two lines in file management in C++?
fstream fin("project.csv",fstream::in); fstream fin("project.csv",ios::in);
Solution 1:[1]
Refer to the image for the hierarchy of classes in C++.
Actually ios_base is the superclass which is inherited by ios class, which is inherited by istream and ostream and both of these are inherited by iostream which is later inherited by fstream, therefore ios::in
or fstream::in
are the same.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | karel |