I've not coded in C++ for a long time and I'm trying to fix some old code.
I'm geting the error:
TOutputFile& TOutputFile::operator<<(TOutputFile&, T)' must have exactly one argument
on the following code:
template<class T>
TOutputFile &operator<<(TOutputFile &OutFile, T& a);
class TOutputFile : public Tiofile{
public:
TOutputFile (std::string AFileName);
~TOutputFile (void) {delete FFileID;}
//close file
void close (void) {
if (isopened()) {
FFileID->close();
Tiofile::close();
}
}
//open file
void open (void) {
if (!isopened()) {
FFileID->open(FFileName, std::ios::out);
Tiofile::open();
}
}
template<class T>
TOutputFile &operator<<(TOutputFile &OutFile, const T a){
*OutFile.FFileID<<a;
return OutFile;
}
protected:
void writevalues (Array<TSequence*> &Flds);
private:
std::ofstream * FFileID;
};
What's is wrong with that operator overloading ?