Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Dynamic Memory Allocation for Objects
SUBMITTED BY:
RavishBhatt
DATE:
June 29, 2016, 10:05 a.m.
FORMAT:
C++
SIZE:
336 Bytes
Raw
Download
Tweet
HITS:
507
Go to comments
Report
#include
<iostream>
using
namespace
std
;
class
Box
{
public
:
Box
()
{
cout
<<
"Constructor called!"
<<
endl
;
}
~
Box
()
{
cout
<<
"Destructor called!"
<<
endl
;
}
};
int
main
(
)
{
Box
*
myBoxArray
=
new
Box
[
4
];
delete
[]
myBoxArray
;
// Delete array
return
0
;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus