如果cout是ostream類的對象,那麼爲什麼我們不能聲明自己的對象,比如說,從同一個類中「out」出來。即不是下面的代碼應該工作?爲什麼我們不能創建我們自己的ostream對象
#include<iostream>
using namespace std;
int main()
{
ostream out;
out<<"something";
}
或以其他方式
#include<iostream>
using namespace std;
int main()
{
ostream_withassign out;
out<<"something";
}
它會做什麼?產出會在哪裏? – 2012-04-09 10:14:06
'ostream_withassign'應該是什麼? – jrok 2012-04-09 10:15:10
你爲什麼認爲這是不可能做到的? – 2012-04-09 10:16:57