#include<iostream>
using namespace std;
class Complex
{
public:
friend ostream& operator<<(ostream &out, Complex &c);
Complex(int a=0, int b=0)
{
this->a = a;
this->b = b;
}
private:
int a;
int b;
};
ostream& operator<<(ostream &out, Complex &c)
{
out << "12345 生活真是苦"<<endl;
out << c.a << "+" << c.b << "i";
return out;
}
void main()
{
Complex c1(1,1);
Complex c2(2,2);
cout << c1<<"12345 上山打老虎";
system("pause");
}
C++ 重载左移运算符
猜你喜欢
转载自blog.csdn.net/error0_dameng/article/details/82121026
今日推荐
周排行