title: C++ Passing variables into a class to a function
body: <p>I have a class "Month" that has void member functions and void parameter passing. I need to overload the constructor (I think) but the compiler doesn't like my attempts.</p>
  
  <pre><code>class Month
  {
  public:
      Month(char firstLetter, char secondLetter, char thirdLetter);    //?
      Month::Month(int m) : month(m) {}  //Want above ^ to look like this
      Month();
      void outputMonthNumber();
      void outputMonthLetters();
      //~Month();   // destructor
  private:
      int month;
  };
  void Month::outputMonthNumber()
  {
    if (month &gt;= 1 &amp;&amp; month &lt;= 12)
      cout &lt;&lt; "Month: " &lt;&lt; month &lt;&lt; endl;
    else
      cout &lt;&lt; "Not a real month!" &lt;&lt; endl;
  }
  void Month::outputMonthLetters()
  {
      const char * monthNames[] = {
          "Jan","Feb","Mar","Apr","May","Jun",
          "Jul","Aug","Sep","Oct","Nov","Dec"
      };
  
      const char * output = "The number is not a month!";
      if (month &gt;= 1 &amp;&amp; month &lt;= 12)
          output = monthNames[month - 1];
  
      cout &lt;&lt; output;
  }
  </code></pre>
  
  <p>Just like how outputting the month numbers were done, I'm trying to do the same for <code>outputMonthNumber</code> but can't wrap my head around it.</p>
  
  <pre><code>int main(void)
  {
      int num;
      char firstLetter, secondLetter, thirdLetter;
      cout &lt;&lt; "give me a number between 1 and 12 and I'll tell you the month name: ";
      cin &gt;&gt; num;
      Month myMonth(num);
      myMonth.outputMonthLetters();
      cout &lt;&lt; endl &lt;&lt; "Give me a 3 letter month and I'll give you the month #: ";
      cin &gt;&gt; firstLetter &gt;&gt; secondLetter &gt;&gt; thirdLetter;
      /*===How would I pass the parameters to the class?===*/
          //Month herMonth(firstLetter, secondLetter, thirdLetter);
          //herMonth.outputMonthNumber();
  }
  </code></pre>
  
  <p>All member functions of class pass void parameters. I understand how to do it for passing one, but I can't seem to get it to overload correctly.</p>