Question d’entretien chez Cisco

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

Réponse à la question d'entretien

Utilisateur anonyme

15 avr. 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