【C/C++】浅拷贝与深拷贝的区别

□当对一个已知对象进行拷贝时,编译系统会自动调用一种构造函数——拷贝构造函数,如果用户未定义拷贝构造函数,则会调用默认拷贝构造函数。 #include <iostream> using namespace std; class Student { private: int num; char *name; //此处类中包含指针 public: Student(); ~Stude
相关文章
相关标签/搜索