How do I implement the finally block in C++?

the finally block concept in Java and C# is not present in c++.. is there any way to implement this