Compiler error 'class_name' is not a type and 'class_name' does not name a type C++

190 Views Asked by At

I can't understand why I am getting this errors. When I make the constructor it shows this errors 'bag' is not a type or 'bag' does not name a type and if i delete the constructor, it compiles.

#include <iostream>
#include "bag.h"

using namespace std;

#ifndef PLAYER_H
#define PLAYER_H

class player {
        string name;
        bag *bag;
    public:
        player(string, bag *);
};

player::player(string name = "DEFAULT_NAME", bag *bag = NULL)
{
    this->name = name;
    this->bag = bag;
}

#endif /* PLAYER_H */

Bag class works fine and compiles, but as soon as I try to make a constructor with bag class I get this errors.

0

There are 0 best solutions below