=号重载问题
#include"iostream.h"#include<string.h>
class String
{
public:
String(char *p1)
{
p=new char[strlen(p1)+1];
strcpy(p,p1);
}
~String()
{delete p;}
void operator=(String obx)
{
strcpy(p,obx.p);
}
char show()
{cout<<p; return 0;}
private:
char *p;
};
void main()
{
String ob1("abc");
String ob2("def");
ob1=ob2;
cout<<ob1.show();
}