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 and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 3 - Page 11 : 36
Notes about C++
Abstraction Mechanisms, Part 1
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

  • The C++ Programming Language: Page 364-367
 

y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/raii/raii-pattern-0.ccA class Resource and its application in the function use_resource - principles only.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/raii/raii-pattern-1.ccA class Resource and its application in the function use_resource - compilable version.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/raii/problem-runProgram output - with no problem_condition.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/raii/normal-runProgram output - with a problem_condition.