Skip to main content

Practice ยท 3 of 3

override catches the bug

Implement class Sensor with virtual std::string reading() const returning "base", and class TempSensor : public Sensor overriding it to return "22C". The signature must match exactly (const included) and the override must use the override keyword.

Difficulty: intermediate

Back to lesson: Practice: Polymorphism and the virtual destructor rule