You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Exams/Final/1st/1.2.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ If you call destructor explicitly and then let object go out of scope, destructo
12
12
Placement new allows constructing an object at a preallocated memory address; then explicit destructor is safe.
13
13
14
14
Example:
15
-
15
+
*/
16
16
#include<iostream>
17
17
#include<new>// for placement new
18
18
usingnamespacestd;
@@ -40,4 +40,4 @@ Destructor called
40
40
41
41
42
42
Note: The final destructor corresponds to the object that exists at end of scope. If you explicitly destroyed t and then did not re-construct, the automatic destructor at scope exit would run on an already-destroyed object → UB. So be careful.
0 commit comments