title: C++ How to implement an unordered_map in .cpp that is instantiated in a header?
body: <p>I am working on a project where I must use unordered_maps to create definitions for morse code and then use them to translate to and from morse code. I am at a complete loss as to how in the world i'm supposed to fill a privately declared unordered_map from a header in the .cpp file. </p>
  
  <p>Using private member functions across files has been an incredible headache in c++ for me and no amount of research has made it at all clear how it actually works so any advice is very welcome. Thanks.</p>
  
  <p>Here's my code.</p>
  
  <p>Morse.h:</p>
  
  <pre><code>#ifndef _MORSE_H
  #define _MORSE_H 3710201612
  
  #define MORSE_SET 45
  
  #include &lt;string&gt;
  #include &lt;unordered_map&gt;
  
  using namespace std;
  
  class MorseCode
  {
    public:
      MorseCode ();
  
      string enCode(const char&amp;) const;
      char   deCode(const string&amp;) const;
  
    private:
      unordered_map&lt;char,string&gt; encodeMap;
      unordered_map&lt;string,char&gt; decodeMap;
  };
  
  #endif
  </code></pre>
  
  <p>Morse.cpp:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;unordered_map&gt;
  
  #include "Morse.h"
  using namespace std;
  
  MorseCode::MorseCode()
  {
  }
  
  string MorseCode::encodeMap
   {
      { 'A', ".-" }, { 'B', "-..." }, { 'C', "-.-." }, { 'D', "-.." }, { 'E', "." },
      { 'F', "..-." }, { 'G', "--." }, { 'H', "...." }, { 'I', ".." }, { 'J', ".---" }, { 'K', "-.-" },
      { 'L', ".-.." }, { 'M', "--" }, { 'N', "-." }, { 'O', "---" }, { 'P', ".--." }, { 'Q', "--.-" },
      { 'R', ".-." }, { 'S', "..." }, { 'T', "-" }, { 'U', "..-" }, { 'V', "...-" }, { 'W', ".--" },
      { 'X', "-..-" }, { 'Y', "-.--" }, { 'Z', "--.." }, { '1', ".----" }, { '2', "..---" }, { '3', "...--" }, { '4', "....-" }, 
      { '5', "....." }, { '6', "-...." }, { '7', "--..." }, { '8', "---.." }, { '9', "----." }, { '0', "-----" },
      { '.', ".-.-.-" }, { ',', "--..--" }, { ':', "---..." }, { '?', "..--.." }, { '-', "-...-" },
      { '/', "-..-." }
  };
  
  char MorseCode::deCode(const string &amp;) const
  {
      return 0;
  }
  </code></pre>