2014-04-18 96 views
0

在C++ primer中第4节8.8.1章节:为什么C++没有为IO对象复制或分配?

为什么没有复制或分配给IO对象?

ofstream out1, out2; 
out1 = out2;    // error: cannot assign stream objects 
ofstream print(ofstream); // error: can't initialize the ofstream parameter 
out2 = print(out2);  // error: cannot copy stream objects 

有谁能告诉我原因吗?非常感谢。

回答

0

简短的回答是:复制或重新分配C++流没有意义。 真正的问题是:你想要达到什么目的?

相关问题