头文件iostream(ostream)

导读 大家好,我是小曜,我来为大家解答以上问题。头文件iostream,ostream很多人还不知道,现在让我们一起来看看吧!1、如果是VS2010的话,声明...

大家好,我是小曜,我来为大家解答以上问题。头文件iostream,ostream很多人还不知道,现在让我们一起来看看吧!

1、如果是VS2010的话,声明为Complex类的友元应该是没有问题的,

2、#include using namespace std; class Complex{ ... friend ostream& operator<<(ostream &os, const Complex &obj); }; 如果还是ostream不明确的话,在类之前加上 class Complex; ostream& operator<<(ostream &os, const Complex &obj); 试试!

本文到此讲解完毕了,希望对大家有帮助。

最新文章