I applied my code so it look like this: 

Person.h:

#include <iostream>
using namespace std;
class Person
{
        public:
                Person::Person(string input);
                string Person::getUserName();
        private:
                string userName;
};


my Person.cpp:

#include "Person.h"
Person::Person(string input)
{
        userName = input;
}
string Person::getUserName()
{
        return userName;
}
void deletePerson(string userName)
{
        cout << "trying to delete " << userName;
}

and my main.cpp:

#include "Person.cpp"

using namespace std;
int main(  )
{
        Person p("jos20");
        cout << p.getUserName();
        return 0;
}

When I compiled the program, it came up with an error 
"duplicate Symbor Person::getUserName()

What did I do wrong?

PS: I use XCode for my programming and I believe I use the gcc that it came up 
with. I was a java programmer so it would be helpful to have a java base 
explanation :D 

Thanx in advance :)


      

Reply via email to