The illustration shows a code segment with the lines numbered from 1 through 40 and the annotations are as follows:
"//Program to demonstrate the function equal. The class DayOfYear
//is the same as in Self-Test Exercises 23–24 in Chapter 10.
#include <iostream>
using namespace std;
class DayOfYear
{
public:
DayOfYear(int theMonth, int theDay);
//Precondition: theMonth and theDay form a
//possible date. Initializes the date according
//to the arguments.
DayOfYear( );
//Initializes the date to January first.
void input( );
void output( );
int getMonth( );
//Returns the month, 1 for January, 2 for February, etc.
int getDay( );
//Returns the day of the month.
private:
void checkDate( );
int month;
int day;
};"
"bool equal(DayOfYear date1, DayOfYear date2);" annotated as "Note that equal is not a member
function of DayOfYear. It is defined outside of the class."
"//Precondition: date1 and date2 have values.
//Returns true if date1 and date2 represent the same date;
//otherwise, returns false.
int main( )
{
DayOfYear today, bachBirthday(3, 21);
cout << "Enter today's date:\n";
today.input( );
cout << "Today's date is ";
today.output( );
cout << "J. S. Bach's birthday is ";"