I'm trying to create class that overwrite cout to be able to write the same massage on multiple channels(standard output, file etc)
class myClass{
private:
ostream &str;
ostringstream ostr;
public:
myClass(ostream &str1){ str=str1; }
............
}
The problem is that I'm trying to use a single instance of the object in all my file:
static myClass _cout(cout);
There is anotoher solution beside static or external? I was thinking about a singleton class but I want that my variable to be global and accessible for all the h and cpp file.