Hi,
Wel I usually have a logging object around that I want to be able to access
from any method or in any file. I usually have that object in the file with
the main routine ( 'CLog Log( "Filename.log" );'. (and 'extern CLog Log;' in
the header file).
Another case would be a class variable. For instance to serialize classes to
and from storage (be it memory disk or somehting else). I have a virtual
function that returns the name of the class. On serializing I first write
that class name (this makes sure a derived will be correctly deserialized).
When deserializing an object located on the heap first the classname is read
then the class is created by mapping the class name in a map<ClassName,
CreateMethod>. The created object is then deserialized in the allocated
space.
--
Regards, Ron AF Greve
http://moonlit.xs4all.nl
"ron_werbin" <ro********@yahoo.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi there,
In what cases will we want to declare our objects static?
for example
*.cpp:
static String xStr;
Than you for any help,
Ron