From d0c96ea64e3c096db077a5a594b24cb6d1986a18 Mon Sep 17 00:00:00 2001 From: Michael McLeod Date: Tue, 18 Mar 2025 18:52:23 +0000 Subject: [PATCH] Update advice on deallocation in constructor --- 05libraries/sec01DesigningClasses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/05libraries/sec01DesigningClasses.md b/05libraries/sec01DesigningClasses.md index 35c1d7d1d..40cee999c 100644 --- a/05libraries/sec01DesigningClasses.md +++ b/05libraries/sec01DesigningClasses.md @@ -128,7 +128,7 @@ The concept of RAII is of great importance in a language like C++ which allows y - Memory allocated by your class should be allocated in the constructor. - Memory allocated by your class should be de-allocated in the destructor. -If the constructor fails to allocate the resources required for the class, then it should throw an exception. Any resources already allocated by the class before reaching the exception should be deallocated by the destructor. +If the constructor fails to allocate the resources required for the class, then it should throw an exception. Any resources already allocated by the class before reaching the exception should be deallocated. The goal is to guarantee the following: