|
-
May 28th, 2002, 04:40 AM
#1
no. of objects
can u tell me . Thanks
Suppose you need to keep track of how many objects of a given class exist. What is the best way (if there is one) to do this?
Choice 1
Add a static member variable that gets incremented in each constructor and decremented in the destructor.
Choice 2
This cannot be accomplished since the creation of objects can be done dynamically via "new".
Choice 3
Add a register member variable that gets incremented in each constructor and decremented in each destructor.
Choice 4
Add an automatic local variable that gets incremented in each constructor and decremented in the destructor.
Choice 5
Add an automatic member variable that gets incremented in the default constructor and decremented in the destructor.
Bye yours
Manorama
Email: [email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|