拷贝构造函数 和 移动构造函数的 浅拷贝

class MyClass { public: int* data; // 默认构造函数 MyClass() : data(nullptr) {} // 拷贝构造函数(浅拷贝) MyClass(const MyClass& other) : data(other.data) {} // 移动构造函数
posted @ 2023-07-19 12:41  SusieSnail_SUN  阅读(5)  评论(0编辑  收藏  举报