Example #1
0
int main()
{
    Temperature outside = Temperature();
    outside.set_fahrenheit(0.0);
    Temperature inside = Temperature(273.15);
    cout << "Outside F: " << outside.getFahrenheit() << endl;
    cout << "Outside K: " << outside.getKelvin() << endl;
    cout << "Inside F: " << inside.getFahrenheit() << endl;
    cout << "Inside K: " << inside.getKelvin() << endl;
//    cout << (outside + 5).getFahrenheit() << endl;
//    Temperature both =  outside + inside;
//    cout << both.getFahrenheit() << endl;
//    cout << both.getKelvin() << endl;
    cout << (outside + inside).getFahrenheit() << endl;
    cout << (outside + inside).getKelvin() << endl;
    return 0;
}
Example #2
0
const Temperature operator+(const Temperature &temp1, const Temperature &temp2)
{ return Temperature(temp1.getKelvin() + temp2.getKelvin()); }