title: Trying to construct simple test class in C++
body: <p>I'm having trouble understanding some errors I've been getting.  I have constructed a simple Test class with a driver.  Can somebody please point out the errors I have made?</p>
  
  <p>Here I'm trying to create a Test object and set the number variable to 1, and then print the number variable.</p>
  
  <p>driver:</p>
  
  <pre><code>#include "test.h"
  #include &lt;iostream&gt;
  using namespace std;
  
  int main() {
      Test *myTest = new Test(1);
      cout &lt;&lt; myTest-&gt;getNumber();
      return 0;
  }
  </code></pre>
  
  <p>test.h</p>
  
  <pre><code>#ifndef __TEST_H__
  #define __TEST_H__
  
  class Test
  {
  private:
      int number;
  
  public:
    Test();
    Test(int theNumber);
    int getNumber();
  };
  
  #endif
  </code></pre>
  
  <p>test.cpp</p>
  
  <pre><code>#include "test.h"
  
  Test() {
  }
  
  Test(int aNumber) {
      number = aNumber;
  }
  
  int getNumber() {
      return number;
  }
  </code></pre>
  
  <p>The error I'm getting here is </p>
  
  <pre><code>&gt; Undefined symbols for architecture x86_64:   "Test::getNumber()",
  &gt; referenced from:
  &gt;       _main in cc8cXu6w.o   "Test::Test(int)", referenced from:
  &gt;       _main in cc8cXu6w.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status
  </code></pre>
  
  <p>Thank you</p>