Consider:
1 2 3 4 5 6 7
|
class X{
//...
istream& source;
public:
//...
void set_source(const istream& ist){/*???*/}
}
|
How can something of this manner be implemented? Perhaps while also supporting:
1 2 3 4
|
//...
X var(cin);
var = X(ifstream("myfile.txt"));
//...
|
Thanks in advance!
Note: I know having an istream& as a class member is weird but bear with me on this.
Last edited on
Ty sir this is the kind of thing I was looking for. I understand that istreams copy constructor has been deleted btw ;).