Lecture overview -- Keyboard shortcut: 'u'  Previous page: A class that needs a destructor -- Keyboard shortcut: 'p'  Next page: Auto Pointers -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Abstraction Mechanisms, Part 1 - slide 11 : 36

Resource acquisition is initialization - RAII

No automatic memory managment in C++

Therefore it is attractive to attach resource management to construction and destruction of stack-allocated objects

The resource is encapsulated in a class together with allocation and release member functions

raii-pattern-0.cc
A class Resource and its application in the function use_resource - principles only.
raii-pattern-1.cc
A class Resource and its application in the function use_resource - compilable version.
problem-run
Program output - with no problem_condition.
normal-run
Program output - with a problem_condition.