题目内容
#include#includeusing namespace std;class String {char* str;public:String(const char* s);void set(int index, char c) { str[index] = c; }char* get() { return str; }~String() { cout << str <<" object is deleted \n"; delete str; }};String::String(const char* s){int l = strlen(s);str = new char[l + 1];strcpy(str, s);}int main(){String s1("Quiz");s1.set(0, 'q');cout << s1.get() <
查看答案
搜索结果不匹配?点我反馈