Most class functions are specific to the object. For example, if you had a Person class with a displayName() function, it would depend on which Person - people have different names. This function would be a member function - it is a member of each object.
However, suppose you had a BankAccount class. Now, all bank accounts have an interest rate of 4.05%. It would make no sense to separately define a variable in every BankAccount object for the interest rate - so we use a static variable. In the class prototype, it would look like this:
and in the definitions,
- BankAccount::interest = 4.05;
Now, every time you wish to use that interest in your BankAccount class, you use BankAccount::interest.
The same thing can be done for functions that will be the same for each object of the class. Just declare the function as static <return type> myFunctionName(<parameters>).