#include
using namespace std;
class IDGenerator{
private:
static int s_nextId ;
public:
static int getNextId(){
return s_nextId++;
}
};
// static members initialized in the global scope
int IDGenerator::s_nextId = 1;
int main(){
for (int i = 0; i < 5; i++)cout << “The next ID is ” << IDGenerator::getNextId() << endl;return 0;}

![[SOLVED] CS #include](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip.jpg)

![[SOLVED] pakudex](https://assignmentchef.com/wp-content/uploads/2022/08/downloadzip-1200x1200.jpg)
Reviews
There are no reviews yet.