c++class-constants

What is the difference between a constant member and a private member without setter?


Suppose I have a constant member and different object have different values for this constant, what is the difference between this constant member and a private member without a setter?


Solution

  • Apart from cv-qualification and accessibility being two completely different concepts there are also practical implications to const public member vs private non-const member.

    It all depends on what you want to do.