I have a class with a data attribute, say of type int, which should be constant throughout the run of the program, and have the same value in all class instances. I want this value to be accessable through a public member function called get_value(). The obvious way to do this is to define a private static const class member and have get_value return it.
Alternatively, I could just place the value in the definition of get_value itself: for example, int get_value()const{return 5;}. Is the first method obviously better than the second?