Student s; Student s1 = s; // 隐式调用拷贝构造函数 Student s2(s); // 显式调用拷贝构造函数
Student s; Student s1; s1 = s; // 使用赋值运算符
一般情况下,类中包含指针变量时需要重载拷贝构造函数、赋值运算符和析构函数。