C++: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Line 46: Line 46:


====Why?====
====Why?====
All objects in have constructor and deconstructor code. When an executable code is loaded into memory, and the program jumps straight into main, the constructor code for each global object has not be run. You could do this manually, by calling in the top of <tt>main()</tt>:
All objects have constructor and deconstructor code. When an executable code is loaded into memory, and the program jumps straight into main, the constructor code for each global object has not be run. You could do this manually, by calling in the top of <tt>main()</tt>:
<pre>
<pre>
object1.object1();
object1.object1();