![[Dept of Engineering]](http://www.eng.cam.ac.uk/images/house_style/engban-s.gif)
Next: Const members
Up: Classes
Previous: Class member privacy
A static member is part of a class, but not part of an object of a class,
so there's only one instance of them however many objects of that class
are created. This is useful if, for instance, you want to keep a
count of how many objects are created.
A static member function
- 1.
- can access private data
- 2.
- is in scope of class
- 3.
- but can't be invoked on an object - objectname.staticmemberfunction() can't access any object-specific data.
Tim Love
2001-07-05