[c++学习笔记09]:运算符重载

运算符重载概念: 对已有的运算符从新进行定义,赋予其另外一种功能,以适应不一样的数据类型。ios 1、加号运算符重载 //一、成员函数重载+号 Person operator+(Person& p) { Person temp; temp.m_A = this->m_A + p.m_A; temp.m_B = this->m_B + p.m_B; return temp; } //二、全局函数重载
相关文章
相关标签/搜索