CS计算机代考程序代写 #include

#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; }

Leave a Reply

Your email address will not be published. Required fields are marked *