My compiler keeps telling me that "None of the 3 overloads could convert all the argument types"
And I'm pretty sure they can, and i have no idea why it keeps telling me that.
double grade(double midterm, double final, double homework)
{
return 0.2 * midterm + 0.4 * final + 0.4 * homework;
}
double grade(double midterm, double final, container& hw)
{
if(hw.size() == 0)
throw domain_error("student has done no homework");
return grade(midterm, final, median(hw));
}
double grade(const Student_info& s)
{
return grade(s.midterm, s.final, s.homework); //this is where the compiler is telling me there's an issue
}
Compiler output:
error C2665: 'grade' : none of the 3 overloads could convert all argument types
: could be 'double grade(double,double,double)'
: or 'double grade(double,double,container &)'
while trying to match the argument list '(const double, const double, const container)'
So yeah, I'm pretty sure there's an overload there to take that call..
Anyone see anything i missed?
Change double grade(double midterm, double final, container& hw) to double grade(double midterm, double final, const container& hw) // Note const and it will match