Tag: Object counter in C++

Implement an objects counter mechanism for a class in C++

Interview question: Can you implement an object counter program in C++ for a class that count the number of objects created for that class. Answer: Actually, counting object in C++ implementation is simple. Solution is, to create a static variable, say “objCount” and a static method like “GetObjectCount()” that returns number of objects created for…

Read the full article