Reusing an Inherited Setter and Getter
easyQuestion 440When base data is private, a derived class cannot touch it directly and must go through the inherited public accessors.
Base class Temperature (already written) has a PRIVATE double celsius with void setCelsius(double c) and double getCelsius() const.
Create a derived class Weather with a method double toFahrenheit() const that uses the inherited getCelsius() to compute celsius * 9.0 / 5.0 + 32.0.
For 100 degrees Celsius the result is 212.0. The runner prints it with one decimal place (see Expected Output).
Do NOT write a main function.
Expected output
212.0= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
Inheritance
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.