Thread: Class Constructor errors

  1. #1

    Class Constructor errors

    i am having trouble getting this silly thing to work.

    i am getting an error that says "return type specification for constructor invalid"

    i am using dev-c++ to compile it

    it is the 24th line down, with the //THIS LINE HAS THE ERROR

    // Player class declaration
    class Player
    char playerName[15];
    char sex; // Male or Female (M/F)
    short int health;
    short int strength;
    short int agility;
    short int magic;
    short int gold;
    Player(int str, int agi); // constructor
    ~Player(); // destructor
    void reportStats(); // shows stats
    void attack(); // kill monster
    void move(); // move N, E, S, or W (do i need parameters?)
    void rest();
    void getPlayerInfo(); // name, sex

    // constructor definition
    Player::Player(int str, int agi) // THIS LINE HAS THE ERROR
    strength = str;
    agility = agi;
    health = 10;
    magic = 20;
    gold = 20;

    Player::~Player() // destructor (does nothing for now)

  2. #2

    the error

    found the error. i forgot to put a ; after the } =P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  3. Defining derivated class problem
    By mikahell in forum C++ Programming
    Replies: 9
    Last Post: 08-22-2007, 02:46 PM
  4. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM