Website Summary Files Commits Branches @commit @diff @stats
path: root / Smart_pointers
diff options
context:
space:
mode:
1 files changed, 6 insertions, 5 deletions
-rw-r--r--Smart_pointers/1. auto_ptr.cpp11
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<Test> smart_pointer_2(new Test());
+
+ auto_ptr<Test> smart_pointer_2(new Test());
+ auto_ptr<Test> smart_pointer_3(smart_pointer_2);
- auto_ptr<Test> 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;