title: unknown function already exists error
body: <p>I have a strange error when i compiled my code it says the member function alreadys exist within another classes which it does not the error says</p>
  
  <blockquote>
    <p>Error LNK2005 "public: void __thiscall membershipType::print(void)"
    (?print@membershipType@@QAEXXZ) already defined in
    personType.obj    Project1    C:\Users\okpal\source\repos\Project1\Project1\Source.obj</p>
  </blockquote>
  
  <p>and also</p>
  
  <blockquote>
    <p>Error LNK1169 one or more multiply defined symbols
    found Project1    C:\Users\okpal\source\repos\Project1\Debug\Project1.exe 1</p>
  </blockquote>
  
  <p>i was wondering if anyone could help figure out the error
  my class code is below</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  class addressType {  //class defintions and prototypes member variables
  public:
      addressType();
      string streetAddressNum, streetName, streetType, city, stateInitials;
      int zipCode;
  };
  class personType
  {
  public:
      personType();
      string firstName;
      string lastName;
      int personNum;
      char gender;
      int personID;
      addressType address;
      void setInterest1(string interest1);//mutator
      void setInterest2(string interest2);
      void printPerson();
      string  GetInterest1() const;    // Accessor
      string  GetInterest2() const;
  private:
      string SetInterest1;
      string SetInterest2;
  };
  //define membershipType class
  class membershipType :public personType
  {
  public:
      char membership_type;
      char membership_status;
      membershipType();  // 1st constructor
      membershipType(char, char);  // 2nd constructor
      void print();
  
  };
  
  void membershipType::print() 
  {
      cout &lt;&lt; GetInterest1();
  }
  </code></pre>
  
  <p>the source code for persontype</p>
  
  <pre><code>#include "personType.h"
  personType::personType()
  {
      int personNum = 0;
      int personID = 0;
  }
  addressType::addressType() {
      int zipCode = 0;
  }
  void personType::setInterest1(string interest1) {
      SetInterest1 = interest1;
  }//mutator
  void personType::setInterest2(string interest2) {
      SetInterest2 = interest2;
  }
  string personType::  GetInterest1() const
  {
      return SetInterest1;
  }// Accessor
  string personType:: GetInterest2() const {
      return SetInterest2;
  }
  
  void personType :: printPerson() {//constructor
  
      cout &lt;&lt; firstName &lt;&lt; " " &lt;&lt; lastName &lt;&lt; " " &lt;&lt; gender &lt;&lt; " " &lt;&lt;
          personID &lt;&lt; " " &lt;&lt; address.streetAddressNum &lt;&lt; " "
          &lt;&lt; address.streetName &lt;&lt; " " &lt;&lt; address.streetType
          &lt;&lt; " " &lt;&lt; address.city &lt;&lt; " " &lt;&lt; address.stateInitials
          &lt;&lt; " " &lt;&lt; address.zipCode &lt;&lt; " " &lt;&lt; SetInterest1 &lt;&lt; " " &lt;&lt; SetInterest2 &lt;&lt; endl;
  }
  </code></pre>