RAII
When using a stream, Closeable
, or any class that uses RAII always properly close it with regard to exceptions.
To avoid having to manually do try...catch
, try to use scoped guards such as unique_ptr
or scoped_guard
. Always try to follow RAII principles in class
es you write by writing a proper constructor and destructor.
Last updated
Was this helpful?