#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;
class String {
char * m_data;
public:
String (const char * other) {
cout<<"我是默认构造函数"<<endl;
int len;
len=strlen(other)+1;
m_data=new char[len];
strcpy_s(m_data,len,other);
}
String (const String& other) {
cout<<"我是拷贝构造函数"<<endl;
int len;
len=strlen(other.m_data)+1;
m_data=new char[len];
strcpy_s(m_data,len,other.m_data);
}
String & operator = (const String& other) {
cout<<"我是赋值构造函数"<<endl;
int len;
len=strlen(other.m_data)+1;
m_data=new char[len];
strcpy_s(m_data,len,other.m_data);
return *this;
}
};
int main (void) {
String a="qwe";
String b("sss");
String c=a;
b=a;
int aa;
cin>>aa;
}