I have my custom class in C++:
Class MyClass
{
private std::ofstream logfile("D:\my.txt",std::ios_base::app);
}
I want to be able to write following:
MyClass *my = new MyClass();
int a = 3;
my << "Hello World1" << a << std::endl;
my << L"Hello World2" << a << std::endl;
Result should be that everything will be saved (redirected) into the private stream (file) named "logfile".
Is it possible? I was trying to use cca this, but without success: https://www.tutorialspoint.com/cplusplus/input_output_operators_overloading.htm