Prove
to yourself that
new
and
delete
always call the constructors and destructors by creating a class with a
constructor and destructor that announce themselves through
cout.
Create an object of that class with
new,
and destroy it with
delete.
Also create and destroy an array of these objects on the heap.
Create
a
PStash
object, and fill it with
new
objects from Exercise 1. Observe what happens when this
PStash
object goes out of scope and its destructor is called.
Create
a class with an overloaded operator
new
and
delete,
both the single-object versions and the array versions. Demonstrate that both
versions work.
Devise
a test for
Framis.cpp
to show yourself approximately how much faster the custom
new
and
delete
run than the global
new
and
delete.