Question: Goal: Learn how to implement subclasses. Assignment: You are developing a smart home system focused on energy efficiency. Part of this system is a smart

Goal: Learn how to implement subclasses.
Assignment: You are developing a smart home system focused on energy efficiency. Part of this system is a smart thermostat that manages heating and cooling cycles to optimize energy usage. The software for the thermostat is built upon a general framework for all the smart devices in the home, however, it needs to be altered to work with the device.
Assume the existence of a SmartDevice class, defined as such:
class SmartDevice
{
private:
string deviceName;
public:
string getDeviceName() return deviceName;
SmartDevice(){ deviceName = "General Smart Device"; }
void setDeviceName(string name){ deviceName = name; }
}
Define a derived class, SmartThermostat, from Smart Device that contains:
A private double member called temperature
A public accessor called 'getTemperature' that takes no parameters and returns a double
A public constructor that sets temperature to 20 degrees, and deviceName to "Smart Thermostat" (Hint: Look at the mutators in Smart Device);
Everything in here is impossible and I legitimately feel the question is incorrect. Please help me.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!