title: Understanding how to correctly treat c++ class constants
body: <p>Consider the following:</p>
  
  <pre><code>namespace MyNamespace{
  class MyClass {
  public:
     // Public area
  private:
     // Private area
  protected:
     // Protected area
  }; /* Class */
  } /* Namespace */
  </code></pre>
  
  <p>And consider that I would like to define a constant which is specific for my class.
  I usually do the following:</p>
  
  <pre><code>namespace MyNamespace{
  // Constants
  const int MYINT = 12;
  const std::string MYSTR = std::string("Hello");
  // Class definition
  class MyClass {
  public:
     // Public area
  private:
     // Private area
  protected:
     // Protected area
  }; /* Class */
  } /* Namespace */
  </code></pre>
  
  <p>In this way I can get my variable in this way (somewhere in my code):</p>
  
  <pre><code>MyNamespace::MYINT;
  MyNamespace::MYSTR;
  </code></pre>
  
  <p>Is this a good practice?
  Considering that constants can be treated in several ways (for example numeric constants are often treated using <code>enum</code>), what is the best approach to define a constant (related to a class, but that can be also useful somewhere else)?</p>
  
  <p>Thankyou</p>