Global Variables which are Objects


When you define global variables that are objects of a class, the constructor can be coded to execute before the main program begins to execute. Further, if the class has a destructor, the destructor can be used to "clean up" after the program finishes execution. For example see example consdesc.cpp.

When this type of construction of the class is used, greater control of the environment is possible. It would not be necessary to access machine language code or OS calls to achieve certain results only C++ code could be used. This would therefore make the code more portable




Intermediate Business Programming with C++
Intermediate Business Programming with C++
ISBN: 738453099
EAN: N/A
Year: 2007
Pages: 142

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net