Local vs Global Object in C++

In the C++ language generally we create an object of class in a main() function or member function but it is also possible to create a object globally.

Such object are called global object.

Example: Write a C++ program to show the difference between local and global object.