#ifndef _FILEHANDLER
#define _FILEHANDLER
#endif
class FileHandler1
{
public :
istream& operator >> ( istream& ins, record_t& record );
istream& operator >> ( istream& ins, data_t& data );
};
FileHandler1.cpp
1 2 3 4 5 6 7 8 9 10 11
#include "Headers.h"
#include "FileHandler1.h"
istream& FileHandler1:: operator >> ( istream& ins, record_t& record )
{
//Same set of code I posted initially
}
istream& FileHandler1:: operator >> ( istream& ins, data_t& data )
{
// Same set of code
}
Now I got below error.
error: ‘std::istream& FileHandler1::operator>>(std::istream&, record_t&)’ must take exactly one argument
In stand alone function I can give Two arguments. But When I declared the same function as a class method, Why am I getting the error as " Must take exactly one argument " ????
Can you change my code to be working ?
Instance functions take an additional hidden parameter which is a pointer to the the instance to work with (the this pointer). It affects the signature of the function.