Do you mean initialize the variable in-class ?
A
static const
is a variable that is not going to change its value for all instances of the class.
A
const
variable on the other hand can have a value that doesn't change for one instance of the class, but can be different for different instances.
A static const example -
class A
{
public:
static const int var = 100;
};
A const example -
class A
{
public:
const int var;
A(int a) : var(a) {}
};
int main()
{
A a(10);
A b(20);
}