C\C++——淺拷貝和深拷貝

class Name { public: Name(const char *str) { len = strlen(str); cout << len << endl;; p = (char *)malloc(len+1); strcpy(p, str); } ~Name() { if (p != NULL) { free(p); p = NULL
相關文章
相關標籤/搜索