let us assume I have a class with
#include <iostream>
using namespace std;
class Test{
public:
friend istream& operator >> (istream& input, Test& test){
input >> test.dummy;
return input;
};
friend ostream& operator << (ostream& output, Test& test){
output << test.dummy << endl;
return output;
};
private:
const int dummy;
}
This does not work because dummy is constant. Is there a way to load from file and recreate an object with parameters which are constant?
Test const&
since you don't change the test class inside it.dummy
isconst
and what you're using theoperator>>
for in you code?