Currently I have something like this:
class FileWritter{
ofstream file;
public:
FileWritter(string filename,A_Class a){//A_Class is class which has defined the >> and the << operators
file.open(filename.c_str());
file<<a;
}
~FileWritter(){
file.close();
}
};
what I want is to have something like this:
template <class AbstractClass>
class FileWritter{
ofstream file;
public:
FileWritter(string fileName, AbstractClass ab){
file.open(fileName.c_str());
file<<ab;
}
~FileWritter(){
file.close();
}
};
in this case, the compiller shows this error:
use of class template requires template argument list
my question is how can I use an template class with FileWritter?