Pergunta de entrevista da empresa Cisco

How would you implement the try/finally construct in C++?

Resposta da entrevista

Sigiloso

15 de abr. de 2014

via destructor of scoped object. I would create a dummy object in "try" scope, and put the "finally" code inside the destructor of that object. Since DTOR is guranteed to be called it will always perform the "finally" statements