In my cdrom class I have a member function called returncost, and a private data member cost.
float cdrom::returncost()
{
return(cost)
}
Later, in a free function I call that member function to calculate a total cost and average cost.
void showcosts (cdrom &cd1, cdrom &cd2, cdrom &cd3)
{
cout << "the total cost of the CD's is:" << (cd1.returncost+cd2.returncost+cd3.returncost)<<endl:
cout << "the average cost of the CD's is:" << (cd1.returncost+cd2.returncost+cd3.returncost)/3 <<endl:
}
It tells me
cdrom::returncost function call missing argument list/ use &cdrom::returncost to create a pointer to member
followed by another error from the same line:
+ illegal left operand has type float (this call cdrom:: *) (void)
Now I know I've done something wrong, but I'm at a loss as to how to fix it, what am I missing that I should know already?