Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

definition of implicitly-declared error

I keep getting this strange error "definition of implicitly-declared ‘player::player()’ player::player()" when I have publicly declared the constructor in the .h file.

Here is my code:

//player.cpp
#include "player.h"
#include <iostream>
using namespace std;

const int SIZE = 100;

player::player()
{
  name = new char[SIZE];
  gen = male;
  level = 0;
}

void player::LevelUp()
{

}

int main()
{
  return 0;
}
~         

//player.h
#ifndef PLAYER_H
#define PLAYER_H

enum gender{male,female,unknown};

class player
{
  public:
    player();
    void LevelUp();
  private:
    char* name;
    gender gen;
    int level;
};


#endif // PLAYER_H

Edit: Is there a reason my post was downvoted? I think this is a legitimate question. This is my first post, maybe I am understanding the posting rules of StackOverflow.com incorrectly?

Comments