title: Trouble with accessing class variables when using header/source files
body: <p>I'm trying to utilize header files and their source files but when I try to access the classes within them I come up with a bit of trouble, here's the code for my header file:</p>
  
  <pre><code>// person.h
  
  namespace PersonFuncs
  {
  class Person;
  
  void getValues ( Person&amp; );
  void setValues ( Person&amp; );
  }
  </code></pre>
  
  <p>And my headers source file:</p>
  
  <pre><code>// person.cpp
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "person.h"
  
  using namespace std;    
  
  namespace PersonFuncs
  {
      class Person
      {
      private:
          string name; // Declaring string variable to hold person's name
          int height; // Declaring integer variable to hold person's height
      public:
          string getName() const; // Reads from 'name' member variable
          void setName ( string ); // Writes to the 'name' member variable
          int getHeight() const; // Reads from the 'height' member variable
          void setHeight ( int ); // Writes to the 'height' member variable
      };
  
      string Person::getName() const
      {
          return name;
      }
      void Person::setName ( string s )
      {
          if ( s.length() == 0 ) // If user does not input the name then assign with statement
              name = "No name assigned";
          else // Otherwise assign with user input
              name = s;
      }
      int Person::getHeight() const
      {
          return height;
      }
      void Person::setHeight ( int h )
      {
          if ( h &lt; 0 ) // If user does not input anything then assign with 0 (NULL)
              height = 0;
          else // Otherwise assign with user input
              height = h;
      }
  
      void getValues ( Person&amp; pers )
      {
          string str; // Declaring variable to hold person's name
          int h; // Declaring variable to hold person's height
  
          cout &lt;&lt; "Enter person's name: ";
          getline ( cin, str );
  
          pers.setName ( str ); // Passing person's name to it's holding member
  
          cout &lt;&lt; "Enter height in inches: ";
          cin &gt;&gt; h;
          cin.ignore();
  
          pers.setHeight ( h ); // Passing person's name to it's holding member
      }
      void setValues ( Person&amp; pers )
      {
          cout &lt;&lt; "The person's name is " &lt;&lt; pers.getName() &lt;&lt; endl;
          cout &lt;&lt; "The person's height is " &lt;&lt; pers.getHeight() &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>Of which both compile with no errors at all! But with this bit of code below where as you can probably see I try to utilize the 'Person' class:</p>
  
  <pre><code>// Person_Database.cpp
  
  #include &lt;iostream&gt;
  #include "person.h"
  
  using namespace std;
  using namespace PersonFuncs
  
  int main()
  {
      Person p1; // I get an error with this
  
      setValues ( p1 );
  
      cout &lt;&lt; "Outputting user data\n";
      cout &lt;&lt; "====================\n";
  
      getValues ( p1 );
  
      return 0;
  }
  </code></pre>
  
  <p>The compiler (which is MS Visual C++) error I get are:</p>
  
  <pre><code>'p1' uses undefined class
  </code></pre>
  
  <p>and</p>
  
  <pre><code>setValues cannot convert an int
  getValues cannot convert an int
  </code></pre>
  
  <p>or something along those lines.</p>
  
  <p>Anybody got any ideas in what I've done wrong? or is there a certain way to access the variables in a class?</p>