After some find and replace refactoring I ended up with this gem:
const class A
{
};
What does "const class" mean? It seems to compile ok.
See Question&Answers more detail:osAfter some find and replace refactoring I ended up with this gem:
const class A
{
};
What does "const class" mean? It seems to compile ok.
See Question&Answers more detail:osThe const
is meaningless in that example, and your compiler should give you an error, but if you use it to declare variables of that class between the closing }
and the ;
, then that defines those instances as const
, e.g.:
const class A
{
public:
int x, y;
} anInstance = {3, 4};
// The above is equivalent to:
const A anInstance = {3, 4};