You have declared member functions for the operations but did not provide definitions (implementations). Your exiting implementations are global functions and not member functions of the
fraction
class (the global functions are declared when defined).
Also you are calling
inc()
without parameter while you only have a
inc(const fraction &)
. So you would have to use
inc(f1)
instead of
f1.inc()
.
But to concatenate operations they must be performed on the object and change the content. So add the missing member function definition(s) omitting one parameter:
class fraction
{
fraction inc();
};
fraction fraction::inc()
{
*this = inc(*this);
return *this;
}