Static Data Member and Static Functions in C++
· When objects of a class containing static data members are created, all the objects share one copy of the class’s static data members.
· A static data member can be accessed within the class definition and the member function definitions like any other data member.
· A fundamental type static data member can be initialized by default to 0.
· A class ‘s static members exist even when no objects of that class exist.
· A static member function can be called even if no objects of the class exist and the static functions are accessed using only the class name and the scope resolution operator.
· A static member function can only access static data member, other static member functions and any other functions from outside the class.
· Static member functions have a class scope and they do not have access to the ‘this’ pointer of the class.
· Static data members will never stores any garbage values.