Listing 3. Encapsulation.
class Date{
  //--- Implementation is private by default
  int month, day, year;//private data members
  ...//other private data members or functions
  public://the class interface is made public
  Date(int mo,int da,int yr);//public constructor
  Date operator+(int n);//public overloaded operator
  ...//other public interface functions
};// note the required semicolon