RAII stands for Resource Acquisition Is Initialization. You acquire resources in the constructor and release them in the destructor. This ties resource lifetime to object lifetime. When the object goes out of scope, the destructor runs automatically, guaranteeing cleanup even if exceptions occur.
You can't forget to free memory or close files. This pattern prevents resource leaks without manual cleanup code scattered throughout your program. The compiler handles cleanup at the right time.