Please help.
I need to keep track of how many object of a given class without introducing
a non-class member variable. Which one of the following will allow me to do
this?
1) Add member variable that gets incremented in the default constructor and
decremented in the destructor.
2) Add local variable that gets incremented in the each constructor and
decremented in the destructor.
3) Add static member variable that gets incremented in the each constructor
and
decremented in the destructor.
4) This cannot be accomplished since the creation of objects is being done
dynamically via "new".
Thank you!
I need to keep track of how many object of a given class without introducing
a non-class member variable. Which one of the following will allow me to do
this?
1) Add member variable that gets incremented in the default constructor and
decremented in the destructor.
2) Add local variable that gets incremented in the each constructor and
decremented in the destructor.
3) Add static member variable that gets incremented in the each constructor
and
decremented in the destructor.
4) This cannot be accomplished since the creation of objects is being done
dynamically via "new".
Thank you!
Comment