Can i declare member variable as const in class of c++?if yes,how?
c++, constants
Solution
You can - you put const in front of the type name.
class C
{
const int x;
public:
C() : x (5) { }
};
Problem
Can i declare member variable as const in class of c++?if yes,how?