Modify ArrayOperatorNew.cpp by adding a static
vector<Widget*> that adds each Widget address that is
allocated in operator new and removes it when it is
released via operator delete. (You may need to look up
information about vector in your Standard C++ Library
documentation or in the 2nd volume of this book,
available at the Web site.) Create a second class called
MemoryCheckerthat has a destructor that prints out the
number of Widget pointers in your vector. Create a
program with a single global instance of
MemoryChecker and in main( ), dynamically allocate
and destroy several objects and arrays of Widget. Show
that MemoryChecker reveals memory leaks.
Modify ArrayOperatorNew.cpp by adding a static vector<Widget*> that adds each Widget address that is allocated in operator new and removes it when it is released via operator delete. (You may need to look up information about vector in your Standard C++ Library documentation or in the 2nd volume of this book, available at the Web site.) Create a second class called MemoryCheckerthat has a destructor that prints out the number of Widget pointers in your vector. Create a program with a single global instance of MemoryChecker and in main( ), dynamically allocate and destroy several objects and arrays of Widget. Show that MemoryChecker reveals memory leaks.