c++ - function or type already defined in persontype -


after compile code,i keep getting error saying severity code description project file line suppression state error lnk2005 "public: void __thiscall membershiptype::print(void)" (?print@membershiptype@@qaexxz) defined in persontype.obj project1 c:\users\okpal\source\repos\project1\project1\source.obj
, severity code description project file line suppression state error lnk1169 1 or more multiply defined symbols found project1 c:\users\okpal\source\repos\project1\debug\project1.exe 1
have no idea how fix these errors in class have nothing defined twice have no idea error mean or how fix it.

include <iostream> #include <string> using namespace std; class addresstype {  //class defintions , 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 << "print"; } 

source file persontype class

#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 << firstname << " " << lastname << " " << gender << " " <<         personid << " " << address.streetaddressnum << " "         << address.streetname << " " << address.streettype         << " " << address.city << " " << address.stateinitials         << " " << address.zipcode << " " << setinterest1 << " " << setinterest2 << endl; } 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -