Hi community.
I have a class Shooter and its constructor's declaration is:
//Shooter.h
Shooter(int health=0, float speed=250.0f, float jumpPower=600.0f, int munitions=1);
As you can see, each argument has its default value.
I have a class Level and in its private part has:
// Level.h that includes "Shooter.h"
private:
Shooter m_mainCharacter;
And its constructor definition is:
// Level.cpp that includes "Level.h"
Level() : m_mainCharacter(1, 300.0f)
{
// Irrelevant things
}
Hence, in its initialization list I don't put a value for jumpPower, then jumpPower takes its default value.
The problem is the following:
Suppose I modify the default value for jumpPower in Shooter.h. When I compile and run the application there isn't a change!!!!
But if I make an irrelevant change in Level.cpp like a newline, or space, etc, when I recompile and run, the behavior is the correct.