简体   繁体   中英

Including fstream or ifstream in a C++ Header File

How does one go about defining methods in a header file that accept either an fstream or ifstream as a paramater?

#include <fstream>
#include <string>

class hw4
{

        public:
                // Methods
                char* cFlagCheck(char* logfile, fstream& f);
                int sFlagCheck(char* set, fstream& f, ifstream& cpy, int &R, int &X, int &Y);
                void* runRobot(void* robotCount);
};

You need to prepend the class names with the std namespace ie. std::ifstream

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM