Possible Duplicate:
In C++ classes, why the semi-colon after the closing brace
This is something I have wondered about for quite some time, why do you have to put a semicolon after the closing bracket of a class, struct or enum in c++?
Worse (or the actual question), why does compilers emit errors about it when they could simply issue a warning?
Is it really important to put that semicolon there and if, why?
It’s a leftover from C. You can declare variables after cladd/struct/enum declaration. the code:
Is identical to:
The compiler needs the
;to know you don’t want to declare variables after the class declaration.