A class definition

The code fragment in Listing 2 creates an abstract data type.

The type's format and behavior is expressed in the definition of a class.

The compiler knows nothing about this data type until it sees the class definition.

Listing 2. Defining an abstract data type.
class Date{
  int month, day, year;//data elements of the class
  public:
  Date(int mo,int da,int yr);//constructor for the class
  int operator+(int n);//overloaded + operator adds dates
  ...//other member functions to define behavior
};//note the required semicolon