[SOLVED] CS #include

$25

File Name: CS_#include.zip
File Size: 103.62 KB

5/5 - (1 vote)

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

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS #include
$25