you need to put the class name before the scope operator if you want to implement a class method:
20 21 22
|
void weight :: getStoneAndPounds ( double stone, double pounds)
{
//...
|
And your setKilograms looks a bit weird ( and doesn't match the class method with the same name )
Last edited on
"undefined reference to X" means you never gave 'X' a body.
In this case, you are declaring your function bodies incorrectly:
void :: setKilograms (double kg, double g)
This is defining a global function named setKilograms. It does not define the setKilograms that belongs to your weight class. Change it to this:
void weight::setKilograms(double g)
You have a similar problem getStoneAndPounds.
The logic for your functions is also wrong, but start with the above.
EDIT: ninja'd by Bazzy >=o
Last edited on