static object in C++

Static objects are declared with the keyword static. They are initialised only once and stored in the static storage area. The static objects are only destroyed when the program terminates i.e. they live until program termination.
```
#include <iostream>
using namespace std;

class Base {
public :
    int a;    
    Base():a(10) { cout << "Base constructed" << endl; }
};

void func() {
    static Base b;
    cout << "The value of a : " << b.a << endl;
}

void func2() {
    Base b;
    cout << "The value of a : " << b.a << endl;
}

int main() {
    func();
    func();
    func2();
    func2();
    return 0;
}
/*
Base constructed
The value of a : 10
The value of a : 10
Base constructed
The value of a : 10
Base constructed
The value of a : 10
*/
```