写着玩的,还知道为什么会错啊?谢谢
#include"stdio.h"#include"string.h"
//void shuchu(char * ,char *);
class string1
{
private:
char *str1;
public:
string1(){}
string1(char *p)
{
str1=p;
}
friend string1 operator +(string1 &p1,string1 &p2)
{ char *str3=strcat(p1.str1,p2.str1);
return string1(str3 );
}
void shuchu()
{
printf(str1);
}
};
void main(int argc, char* argv[])
{
string1 a("ceshi1") ,b("ceshi2"),c;
printf("Hello World!\n");
c=a+b;
c.shuchu();
}