友元函数,将运算符+重载为类的成员函数,实现类的对象相加运算

2025-03-06 17:12:45
推荐回答(1个)
回答1:

类里面写上 operrator*函数的定义.
类里面写一行friend sample operator*(sample &s1,sample &s2);