Prefer const and inline to #define.

This commit is contained in:
mpabi 2024-05-25 17:08:02 +00:00
parent ea8abde781
commit cdb06c4c44
1 changed files with 9 additions and 4 deletions

View File

@ -12,14 +12,19 @@ void strcpy(char *s, char *t)
while (*s++ = *t++);
}
class GamePlayer {
// Effective C++ by Scott Meyers
// page. 6
// Item 1: Prefer const and inline to #define.
//
class NewDefine{
private:
static const int ALLOCSIZE= 10000;
static const int NUM_TURNS = 5;
int scores[NUM_TURNS];
};
} c;
const int NewDefine::ALLOCSIZE;
#define ALLOCSIZE 10000