#include<iostream>
using namespace std;
class CMystring
{
private :
char *pData;
public :
CMystring(char *p = NULL) : pData(p) {}
~CMystring() {}
CMystring & operator = (const CMystring&str)
{
CMystring strtemp(str);
if(this != &str)
{
char *temp = strtemp.pData;
strtemp.pData = pData;
pData = temp;
}
return *this;
}
void show()
{
cout<<*pData<<endl;
}
};
int main()
{
char *p = "NIMI";
CMystring *cs = new CMystring(p);
CMystring *csq(cs);
csq->show();
return 0;
}
using namespace std;
class CMystring
{
private :
char *pData;
public :
CMystring(char *p = NULL) : pData(p) {}
~CMystring() {}
CMystring & operator = (const CMystring&str)
{
CMystring strtemp(str);
if(this != &str)
{
char *temp = strtemp.pData;
strtemp.pData = pData;
pData = temp;
}
return *this;
}
void show()
{
cout<<*pData<<endl;
}
};
int main()
{
char *p = "NIMI";
CMystring *cs = new CMystring(p);
CMystring *csq(cs);
csq->show();
return 0;
}