Overloading logical operators considered bad practice?

前端 未结 7 678
星月不相逢
星月不相逢 2021-01-11 13:40

Is it a bad idea to overload &&, || or comma operator and Why?

7条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-11 14:28

    For overloading the logical operators in C++, the operands must be evaluated, which isn't the way things normally work with short circuiting of built-in types.

    Look at the below link.

    • Don't overload logical operators in C++

提交回复
热议问题