A static
class member is a member that is associated with the class, rather than with individual objects of the class type. It exists outside any object of the class.
Advantages:
- Storage efficient.
- If a
static
member of a class changes, each object of the class will use the new value of thatstatic
member. - A
static
data member can have incomplete type. - A
static
member (either a data member or a member function) can be used as a default argument.
Differences between ordinary members and static
members:
- A
static
member belongs to the class, an ordinary member belongs to objects of the class.