According to "C++ Primer, 5th Ed.", section 8.1.1:
ofstream out1, out2;
out1 = out2; // error: cannot assign stream objects
// print function: parameter is copied
ofstream print(ofstream); // error: can't initialize the ofstream parameter
out2 = print(out2); // error: cannot copy stream objects -- Line 4
Line 4 says "cannot copy stream objects". Is it implying on the print()
command on line 4, or the =
, that a copy is not permitted? The =
to me is the assignment statement while the print(out2)
is calling the constructor of ofstream
passing the out2
argument. So I'm a bit confused here.
Can anyone explain better?
Aucun commentaire:
Enregistrer un commentaire