Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit077b4d26b6401643b625014d6bef1655bf7b9a0e (patch)
Author
 Angel Dimitriev <achi_d@abv.bg>
2020-03-15 22:15:22 +0200
Committer
 GitHub <noreply@github.com>
2020-03-15 22:15:22 +0200
Files2fffa677f2e57ed0e30445f3f9634599df8aa2d3
Object-oriented_programming_FMI-077b4d26b6401643b625014d6bef1655bf7b9a0e.tar
Object-oriented_programming_FMI-077b4d26b6401643b625014d6bef1655bf7b9a0e.tar.gz
Object-oriented_programming_FMI-077b4d26b6401643b625014d6bef1655bf7b9a0e.zip
Parent1aa1048deef6f53bef188b593f67f28e79171b97 (diff)
Update 1. uniqe_ptr.cpp
1 files changed, 7 insertions, 1 deletions
-rw-r--r--Smart_pointers/1. uniqe_ptr.cpp8
diff --git a/Smart_pointers/1. uniqe_ptr.cpp b/Smart_pointers/1. uniqe_ptr.cpp
index c5637a4..abbb1c7 100644
--- a/Smart_pointers/1. uniqe_ptr.cpp
+++ b/Smart_pointers/1. uniqe_ptr.cpp
@@ -30,13 +30,19 @@ public:
{
cout<<"Detructor"<<endl;
}
+ void f()
+ {
+
+ }
};
int main()
{
{
unique_ptr<Test> smart_pointer_1(new Test()); //Test()
-
+
+ smart_pointer_1->f(); // Достъпваме данните, както с обикновен пойнтер.
+
Test* obj = smart_pointer_1.get(); //От тук иматаме достъп до паметта, към която сочи пойнтера.
//delete obj; // Това не трябва да се прави! smart_pointer_1 не знае, че паметта е освободена и ще се опита да я освободи, което ще доведе до грешка!