Beginner question about getting reference to cin
- by John C
I'm having problems wrapping my head around this. I have a function
void foo(istream& input) {
input = cin;
}
This fails (I'm assuming because cin isn't supposed to be "copyable".
however, this works
void foo(istream& input) {
istream& baz = cin;
}
Is there a reason that I can get a reference to cin in baz but I cannot assign it to input?
Thanks