常量类怎么传出引用?
  • 板块学术版
  • 楼主金庆涵
  • 当前回复5
  • 已保存回复5
  • 发布时间2021/1/28 22:04
  • 上次更新2023/11/5 04:12:52
查看原帖
常量类怎么传出引用?
177878
金庆涵楼主2021/1/28 22:04
class point{
	public:
		inline int& gett(void);
		inline int& getw(void);
		inline void scan(void);
		inline bool operator<(const point&)const;
	private:
		int t,w;
		void ckmax(int&,const int&);
	
};
inline void point::scan(void){
	get(this->t),get(this->w);
	this->ckmax(mx,t);
	return;
};
inline bool point::operator<(const point &a)const{
	return this->t>a.gett();
};
inline void point::ckmax(int &x,const int &y){
	if(x<y)x=y;
	return;
};
inline int& point::gett(void){
	return this->t;
};
inline int& point::getw(void){
	return this->w;
};

operator<函数中由于return被编译器阻止,应该怎么办

2021/1/28 22:04
加载中...