In C++ there are static and non-static const
data members.
When I want a constant, I always make it static
because it does not make sense to have multi
static const
applies to the classconst
applies to the objectE.g.
class Verticies {
public:
const int colour;
static const int MAX_VERTICIES = 100;
Point points[MAX_VERTICIES];
Verticies(int c) : colour(c) { }
// Etc
};
Here MAX_VERTICIES
applies to all objects of type Verticies
. But different objects could have different colours and that colour is fixed on construction