Should I return bool or const bool?

后端 未结 11 883
我在风中等你
我在风中等你 2021-01-01 10:36

Which is better:

bool MyClass::someQuery() const;

const bool MyClass::someQuery() const;

I\'ve been using \'const bool\' since I\'m sure I

11条回答
  •  萌比男神i
    2021-01-01 11:08

    It completely doesn't matter. Therefore, the consensus is to return just bool.

    The reason that it doesn't matter is that you can't call non-const member functions anyway; bool is not a class or struct.

提交回复
热议问题