Question.2
A developer manually calls a destructor on a stack object:
void func() { Sensor s(5); s.~Sensor(); // Manual destructor call // ... more code ... } // End of scope -- destructor called again!
What happens?
Select Answer
Nothing unusual -- the second call is safely ignored
Undefined behavior -- the destructor runs twice; the second call may double-free resources or corrupt state
Compilation error -- manual destructor calls are not allowed
The object is re-initialized after the manual call