Console C++ - static const xxyy

Defining static const variables in a class - g++ allows it, Borland does not. The following fragment is from the problem set provided by the teacher.

Borland C++ | Visual C++ | GNU g++ (Unix)


Borland C++ 5.02

I never found a way to create and initialize NULL_ITEM using the syntax provided by the teacher. Instead, I created a global variable in the .cxx (.cpp) file and initialized it in the constructor.

This technique makes the variable both static and private since it is only known inside the .cxx file. However, it looses some of its namespace localization since other global valiables could have the same name.


Microsoft Visual C++


GNU g++ (Unix)


Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / Languages / Console_C++ / static_const.html