#define _CRT_SECURE_NO_DEPRECATE
#include <iostream>
using namespace std;
class MyString{
public:
char* pstr;
int length;
MyString(const char* str){
this->length = strlen(str) + 1;
this->pstr = new char[length]{0};
strcpy(this->pstr, str);
}
void show(){
cout << "lebgth " << length << " address " << (void*)pstr << " " << pstr << endl;
}
~MyString(){
delete[] pstr;
}
MyString(const MyString& mystr){
this->length = mystr.length;
this->pstr = new char[mystr.length]{0};
strcpy(this->pstr, mystr.pstr);
}
};
void main(){
MyString mystr("Nanjing");
mystr.show();
MyString mystr2(mystr);
mystr2.show();
mystr.~MyString();
mystr2.show();
cin.get();
}