Question.6
A Timer class internally switches from a software-based counter to a hardware-based register without altering its public interface.
Version 1 (software timer):
class Timer {
int counter;
public:
int getTime() const { return counter; }
};Version 2 (hardware timer):
class Timer {
volatile uint32_t* hw_reg;
public:
int getTime() const { return *hw_reg; }
};Does the user code need to change?