index:   hello1  hello2  hello3  hello4    source:  hello.zip

hello1.cpp

hello1.cpp creates a global object and exits.



#include <iostream>
using namespace std;

class theWorld {
public:
	theWorld() { cout << "Hello from the world.\n"; }
	~theWorld() { cout << "Goodbye from the world.\n"; }
};

theWorld myWorld;

int main()
{
	cout << "Hello from main program.\n";
}


Results

C:\classes\ece538\work\hello>hello1
Hello from the world.
Hello from main program.
Goodbye from the world.


Maintained by John Loomis, updated Tue Jan 23 20:44:57 2007