class Fixing {
friendvoid friendFixing(Fixing &f);
private:
int kelvin;
public:
Fixing(int v) {kelvin = v;}
voidoperator=(const Fixing &right);
};
void Fixing::operator=(const Fixing &right)
{
cout << kelvin + right.kelvin*25 << endl;
}
void friendFixing(Fixing &f)
{
cout << "The value of kelvin is " << f.kelvin << ".\n";
}
int main(void) {
Fixing a[2] = {5, 10};
a[1] = a[0]; // does NOT set a[1].kelvin equal to 5!
Fixing b(15);
friendFixing(a[0]);
cout << "The value of kelvin for object b is ";
//cout << b.kelvin << ".\n";
}
the output is
135
the value of kelvin is 5
the value of kelvin for object b is
can anyone explain to me how the overload equation and stuff give the output of 135? i know 135 is 10+5*25, but didn't the overload said kelvin + right.kelvin*25? isnt' it suppose to be 5 + 10*25? why 135 is the output?