/*
让“+”具有连接字符的功能
*/
#include "iostream.h"
#include "string.h"
class Str
{
private:
char j[20];
public:
Str(){}
Str(char j[10])
{
strcpy(this->j,j);
}
Str operator + (Str b)
{ Str z;
strcpy(z.j,strcat(this->j,b.j));
return z;
}
void display()
{
cout<<j<<endl;
}
};
void main()
{
Str a("软件12班");
Str b("王双");
Str z;
z=a+b;
z.display();
}