#include<iostream.h>
#include<string.h>
class verb
{private:
int leng;
char *str;
public:
verb()
{strcpy(str,"no");
leng=0;
}
verb(char *i)
{leng=strlen(i);
str=new char[leng+1];
strcpy(str,i);
}
~verb()
{delete str;}
verb operator+(const verb &a)
{verb t;
t.leng=leng+a.leng;
t.str=new char[t.leng+1];
strcpy(t.str,str);
strcat(t.str,a.str);
return t.str;
}
void show()
{cout<<str;}
};
void main()
{verb a("sfsdf"),b("dsf"),c;
c=a+b;
c.show();
}
本程序无错误,可运行却什么也没有,希望高手们指点一下,谢谢