What is the use of Static objects.

Hi,

Can any one explain what is the use of static objects in C++.

What I know is static objects are allocated in data segment and It will have its exsistance between diffent function calls.

Since this is a object then how is the value will be same.

Do the differnt objects have occupy the same memory location?


Thanks & Regards,
Amiya.
A static object is one with global lifetime, but constrained scope.

Class static objects are names within the class, but can be accessed anywhere in the program public/private/protected/friend obeying rules.

File static objects or those declare in a local namespace are confined to those places and are not generally accessible throught the program directly.
Topic archived. No new replies allowed.