From e2cefdecadaac77684902c07d802808570b665de Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Sun, 15 Mar 2020 21:24:31 +0200 Subject: Update 1. auto_ptr.cpp --- Smart_pointers/1. auto_ptr.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Smart_pointers') diff --git a/Smart_pointers/1. auto_ptr.cpp b/Smart_pointers/1. auto_ptr.cpp index bbafcd6..a28851b 100644 --- a/Smart_pointers/1. auto_ptr.cpp +++ b/Smart_pointers/1. auto_ptr.cpp @@ -36,13 +36,14 @@ int main() } //Test (Паметта се освобождава сама) { - auto_ptr smart_pointer_2(new Test()); + + auto_ptr smart_pointer_2(new Test()); + auto_ptr smart_pointer_3(smart_pointer_2); - auto_ptr smart_pointer_3(smart_pointer_2); - - smart_pointer_2.get(); // Това ще даде NULL, защото smart_pointer_3 "открадна" обекта на smart_pointer_2 -} + smart_pointer_2.get(); // Това ще даде NULL, защото smart_pointer_3 "открадна" обекта на smart_pointer_2 + + } return 0; -- cgit v1.3.1-23-gd82d