title: static const data member vs hard-coded value in function
body: <p>I have a class with a data attribute, say of type <code>int</code>, 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 <code>get_value()</code>.  The obvious way to do this is to define a private <code>static const</code> class member and have <code>get_value</code> return it.  </p>
  
  <p>Alternatively, I could just place the value in the definition of <code>get_value</code> itself: for example,  <code>int get_value()const{return 5;}</code>.  Is the first method obviously better than the second? </p>