I have a class for local use only (i.e., its cope is only the c++ file it is defined in)
class A {
public:
static const int MY_CONST = 5;
};
void fun( int b
std::minconst int&
(not just int
), i.e. references to int
. And you can't pass a reference to A::MY_CONST
because it is not defined (only declared).
Provide a definition in the .cpp
file, outside the class:
class A {
public:
static const int MY_CONST = 5; // declaration
};
const int A::MY_CONST; // definition (no value needed)