We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ld = si + ld; 我看很多人都说只能转换成内置类型进行相加operator+(int,float)或者operator+(int,double) 为什么下面这种不行呢 friend SmallInt operator+(const SmallInt &,const SmallInt &); ld可以先转换成float或者double然后再转换成int。SmallInt可以调用SmallInt(int = 0); 构造一个临时对象 然后得到SmallInt再转换成int类型,再转换成double最后调用LongDouble(double = 0.0);构造一个临时对象。这种方式不行吗?虽然也会产生二义性。
operator+(int,float)
operator+(int,double)
friend SmallInt operator+(const SmallInt &,const SmallInt &);
SmallInt(int = 0);
LongDouble(double = 0.0);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ld = si + ld;
我看很多人都说只能转换成内置类型进行相加
operator+(int,float)
或者operator+(int,double)
为什么下面这种不行呢
friend SmallInt operator+(const SmallInt &,const SmallInt &);
ld可以先转换成float或者double然后再转换成int。SmallInt可以调用
SmallInt(int = 0);
构造一个临时对象然后得到SmallInt再转换成int类型,再转换成double最后调用
LongDouble(double = 0.0);
构造一个临时对象。这种方式不行吗?虽然也会产生二义性。The text was updated successfully, but these errors were encountered: