I will try to be as explicit as I can.
I have an exercise to solve, I've searched a lot on the web but could not find what my issue is.
Because this is an 'as is' Exercise I cannot modify float* to float[], I must use the values given and the function signature given. All I can work with is the contains of setWeight function.
Consider the following:
class Train
{
protected:
float* weight;
public:
setWeight(float* weight)
{
this->weight = weight;
}
}
Then in main I call the following:
main()
{
float weights[] = { 30.5f, 20.0f, 12.7f, 15.88f };
train.setWeight(weights);
}
When I look in debug mode only the first value gets passed. Can someone help me out?