Skip to main content

Practice · 3 of 3

override catches the bug

CHALLENGE
Difficulty: intermediate+25 XP

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.

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