Klassenlokale Konstanten sind leider nicht möglich. Auch statische Datenelemente helfen nicht:
class X { static const int BUFSIZ=100; // FALSCH char buffer[BUFSIZ]; };
Auch so geht es nicht:
class X { static const int BUFSIZ; char buffer[BUFSIZ]; // FALSCH }; const int X::BUFSIZ=100;
Was jedoch geht, sind klassenlokale Aufzählungstypen. Damit kann man wenigstens ganzahlige Konstanten implementieren:
class X { enum {BUFSIZ = 100}; char buffer[BUFSIZ]; // OK };