I'm creating a new object of my class 'Dynamic' (not shown), which inheritates from 'Organic', which inheritates from 'Being' certain parameters such as id, biomeRow, etc.
Organic has: features_ (a struct), max_spawn_, total_spawn_, age_dur_ (an array) and current_age_.
The problem: Upon creating a Dynamic object, all values are set just right except max_spawn_. I've done my printfs both before creating Dynamic, in the creation of Dynamic and in the creation of Organic for the input value, and all of them are correct.
Features struct is right, total_spawn_ is right, age_dur_ array and current_age_ are both also right.
All of them are what I asked except for max_spawn_. maxSpawn is the value I'm passing (20), max_spawn_ should then be 20, but it isn't. All my printfs and debugging console show it is something around -858993460. I'm guessing that's just garbage, but I don't know how is it possible when all I'm doing is:
max_spawn_ = maxSpawn;
So, this is my function:
Organic::Organic(int id, int biomeRow, int biomeColumn, int biomeType, int beingType,
int object, Features features, int maxSpawn, int totalSpawn,
int age_dur[5], int current_age)
: Being(id, biomeRow, biomeColumn, biomeType, beingType, object)
{
features_ = features;
max_spawn_ = maxSpawn;
total_spawn_ = totalSpawn;
age_ = current_age;
for (int i = 0; i <= 5; i++)
age_dur_[i] = age_dur[i];
printf("\n%d\n", max_spawn_);
}