title: Using static const char* const instead of #define
body: <p>I get the error <code>error: ‘Name’ was not declared in this scope</code>
  What am I missing here. </p>
  
  <p>Source File:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include "scr.h"
  using namespace std;
  
  const char* const Test::Name;  
  
  void Test::Print()
  {
      cout&lt;&lt;Name;
  }
  
  int main()
  {       
      Test *t = new Test();
      t-&gt;Print();
      delete t;   
  }
  </code></pre>
  
  <p>Header File:</p>
  
  <pre><code>class Test
  {   
      static const char* const Name = "Product Name";
      public:
          void Print();
  };
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>If I replace <code>char* const</code> with <code>int</code>, it works. Why?</p>
  
  <pre><code>static const int Name = 4; //in header
  
  const int Test::Name;  //In source
  </code></pre>
  
  <p>The purpose of the code is to have an alternate for <code>#define</code> as mentioned in Effective C++. In the example there, <code>static const int</code> is used.</p>