Skip to content

Glossary: Software Design Patterns in C++

RAII

Also written: Resource Acquisition Is Initialization

The C++ habit where an object's constructor acquires something and its destructor releases it, as `std::ifstream` opens and closes a file. It works like a hidden template method, and it is why a test's `Repo` is cleaned up automatically when its scope ends.

Where the book teaches it

Related terms

Template method