Website Summary Files Commits Branches @commit @diff @stats
path: root / Smart_pointers / 1. auto_ptr.cpp
diff options
context:
space:
mode:
Commite2cefdecadaac77684902c07d802808570b665de (patch)
Author
 Angel Dimitriev <achi_d@abv.bg>
2020-03-15 21:24:31 +0200
Committer
 GitHub <noreply@github.com>
2020-03-15 21:24:31 +0200
Fileseb6f37d04db9171e9d41e6dbc740d132657e1a51 /Smart_pointers/1. auto_ptr.cpp
Object-oriented_programming_FMI-e2cefdecadaac77684902c07d802808570b665de.tar
Object-oriented_programming_FMI-e2cefdecadaac77684902c07d802808570b665de.tar.gz
Object-oriented_programming_FMI-e2cefdecadaac77684902c07d802808570b665de.zip
Parent03edf9c2e760d2adedef8c4bf65b84be2a4b7515 (diff)
Update 1. auto_ptr.cpp
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;