版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/endeavor_he/article/details/71108571
错误:no match 为 ‘operator+’ 在 ‘10 + p’ 中
C++中类的直接相加显然是错误的
解决方法:
添加一个operator+(int,p)友元重载就可以解决问题
运行结果:
错误:no match 为 ‘operator+’ 在 ‘10 + p’ 中
C++中类的直接相加显然是错误的
解决方法:
添加一个operator+(int,p)友元重载就可以解决问题
运行结果: