Ray's playground

 

Item 7:Never overload &&, ||, or ,.(More Effective C++)

The purpose of operator overloading is to make programs easier to read, write, and understand, not to dazzle others with your knowledge that comma is an operator. If you don't have a good reason for overloading an operator, don't overload it. In the case of &&, ||, and ,, it's difficult to have a good reason, because no matter how hard you try, you can't make them behave the way they're supposed to. 

posted on 2011-06-11 11:16  Ray Z  阅读(162)  评论(0编辑  收藏  举报

导航