169. Encapsulation

Question.3

A TempSensor class defines a private member without a corresponding setter method.

The temperature value is retrieved via a const getter.

class TempSensor {
   float temperature;
public:
   float getTemp() const { return temperature; }
   void update() { temperature = read_hw_adc() * 0.01f; }
};

Which statement describes the accessibility of the temperature member?

Need Help? Refer to the Quick Guide below

Select Answer

Restart quiz!