#include <iostream> using namespace std; //word类展现了默认拷贝语义,不会合成默认拷贝构造函数,而是对于每一个成员变量实时memberwise的bitcopy class Word { public: Word(const char*) { } ~Word(){delete [] str;} private: int cnt; const char* str; }; int main() { Word A("123"); Word B = A; getchar(); return 0; }
时间: 2024-10-11 07:01:48