Question.7
A developer worries that calling getSpeed() is slower than accessing motor.speed directly:
getSpeed()
motor.speed
class Motor { float speed; public: inline float getSpeed() const { return speed; } };
Is there a performance difference?
Select Answer
Yes, calls add stack overhead
Yes, only in debug builds
No, compilers inline trivial getters
No, requires high optimization levels