I'm writing a program for my class that has us creating a Fraction class and making some member functions and such for it. One of the requirements is that we need to have three other functions not including the ones in the class and one of these functions has to accept a pointer to a Fraction object and this function must use the pointer to update the object. This is what i have so far let me know if you need the whole code. I get this error when i try to compile the code.
void update_object(int, int, Fraction); //function prototype
...
update_object(x,y,*a); //call to function in int main()
...
void update_object (int xnum, int yden, Fraction *obj)
{
obj->setNumerator(xnum);
obj->setDenominator(yden);
return; //function body
}
...Yes, you are passing a pointer to your Fraction obj. As for what it does, only you can answer that as I don't know what it is "supposed" to do. It is modifying the actual object, if that's what you mean.
if you put your UpdateObject function before your main function (or before whatever function it is called in) you wouldnt need a prototype declaration in the first place.