Lecture overview -- Keyboard shortcut: 'u'  Previous page: Classes and Conversion: Examples -- Keyboard shortcut: 'p'  Next page: Const member functions -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Abstraction Mechanisms, Part 1 - slide 21 : 36

Static class members

Static class members are related to the class as such

Static class members in C++ are similiar to static variables and methods in Java and C#

point.h
A variant of class Point with static members.
point.cc
Implementation of class Point.
prog.cc
A client of class Point.
program-output
Program output.

Initialization of non-local static objects is problematic in general (in particular initialization order).

Therefore we explore an alternative.

point.h
A variant of class Point with static member function for the defaultPoint.
point.cc
Implementation of class Point.
prog.cc
A client of class Point.