A class is defined at the end of its class-specifier. Member functions need not be defined in order for the class to be considered defined. Consider the following:
class Point // Point class
{ // considered defined.
public:
Point()
{ cx = cy = 0; } // Constructor defined.
Point( int x, int y )
{ cx = X, cy = Y; } // Constructor defined.
unsigned &x( unsigned ); // Accessor declared.
unsigned &y( unsigned ); // Accessor declared.
private:
unsigned cx, cy;
};
Even though the two accessor functions (x
and y
) are not defined, the class Point
is considered defined. (Accessor functions are functions provided to give safe access to member data.)