(a == 1)&&(a == 2)&&(a == 3)可以评估为真吗? (这有用吗?) [英] Can (a==1)&&(a==2)&&(a==3) evaluate to true? (and can it be useful?)
本文介绍了(a == 1)&&(a == 2)&&(a == 3)可以评估为真吗? (这有用吗?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
受到有关 java-脚本语言.表达式
(a==1)&&(a==2)&&(a==3)
在C ++中评估为true? (如果是这样,它真的有用吗?)
evaluate to true in C++? (And if so, can it actually be useful?)
推荐答案
是的,
class Foo
{
public:
bool operator==(int a)
{
return true;
}
};
然后,让a
为Foo
类型,瞧.
这真的有用吗?我真的不认为这很有用.
Can this actually be useful? I don't really see it being useful no.
这篇关于(a == 1)&&(a == 2)&&(a == 3)可以评估为真吗? (这有用吗?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文