Здравствуйте!
Помогите, пожалуйста, решить проблему. Выдаётся сообщение:
GameCharacter.h:13: error: 'defaultHealthCalc' is not a member of 'GameStuff'
explicit GameCharacter( std::string name, HealthCalcFunc hcf = GameStuff::defaultHealthCalc )
GameCharacter.h
C++ (Qt)
#ifndef GAMECHARACTER_H
#define GAMECHARACTER_H
#include <string>
#include "functionsForHealthCalc.h"
namespace GameStuff {
class GameCharacter {
public:
typedef int (*HealthCalcFunc)(const GameCharacter&);
explicit GameCharacter( std::string name, HealthCalcFunc hcf = GameStuff::defaultHealthCalc )
{
}
};
}
#endif // GAMECHARACTER_H
functionsForHealthCalc.h
C++ (Qt)
#ifndef FUNCTIONS_FOR_HEALTHCALC_H
#define FUNCTIONS_FOR_HEALTHCALC_H
#include "GameCharacter.h"
namespace GameStuff {
class GameCharacter;
int defaultHealthCalc( const GameCharacter& gc );
}
#endif // FUNCTIONS_FOR_HEALTHCALC_H
functionsForHealthCalc.cpp
C++ (Qt)
#include "functionsForHealthCalc.h"
namespace GameStuff {
int defaultHealthCalc( const GameCharacter& gc ) {
return 1;
}
}