
作业社区
探索学习新天地,共享知识资源!
0份
提交作业
0个
布置作业
0份
满分作业
讨论题
学习任务
学习任务
讨论题
讨论题
讨论题
项目作业
讨论题
daishuuuu 的学生作业:
// 2025-08-17, constructor in c++ #include using namespace std; class String{ public: // constructor with parameters String(const char *str = NULL); void show(void); private: char *str; }; String::String(const char *str) { // how to safely assign the value of the string this->str = (char *)malloc(sizeof(str)); int i = 0; while (str[i] != '\0') { this->str[i] = str[i]; i++; } }; void String::show(void) { int i = 0; while (this->str[i] != '\0') { cout





来源:嵌入式软件工程师 · C++构造函数 - 课后练习
讨论题