关于重载运算符
  • 板块灌水区
  • 楼主exdtables
  • 当前回复6
  • 已保存回复6
  • 发布时间2021/11/14 13:53
  • 上次更新2023/11/4 00:36:46
查看原帖
关于重载运算符
359675
exdtables楼主2021/11/14 13:53
#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
#include<io.h>
using namespace std;
class A{
	public:
		int a;
};
class B{
	public:
		int a;
};
operator>(const A& a,const B& b){
	return 9;
}
int main(){
	A c;B d;
	cout<<(c>d);
	return 0;
}

9

Process exited after 0.5311 seconds with return value 0 请按任意键继续. . .

就是说,重载运算符的返回值不是boolbool

2021/11/14 13:53
加载中...