64,633
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
using namespace std;
class test
{
public:
string a;
public:
test(string b){a=b;}
friend string operator+(test);
};
string operator+(string c,test a)
{
c=c+a.a;
return c;
}
void main()
{
test d("world!");
string s="Hello ";
s=s+d;
cout<<s<<endl;
}