一個模擬寫實拷貝技術的例子------引用計數

#include<iostream> using namespace std; #include<string> class myString { public: myString() { cout << "默認構造函數" << endl; _str = new char[5]; //以頭部的4個字節來描述引用次數 _str[4] = 0; getCount() = 1; }
相關文章
相關標籤/搜索