class Student{ public: int id; string name; int age; void operator =(Student S){ this->id=S.id; this->name=S.name; this->age=S.name; } } int main(){ Student S; //……对S初始化 Student S2=S; return 0; }
C++ 运算符重载
原文:https://www.cnblogs.com/LesBlog/p/12567187.html