#include <iostream>
using namespace std;

//class defined page 225
class Date {
private:                                 //implied if not specified
                                         //in a class
   int d, m, y;
public:                                  //public interfaces of the class
   void init (int dd, int mm, int yy);   //initialize
   void add_year(int n);			      //add n years
   void add_month(int n);                //add n months
   void add_day(int n);                  //add n days
};

Date my_birthday;                        //file scope variable

void f();  //test function pages 224-225 //function prototype

int main()
{
     f();
}

void Date::init(int dd, int mm, int yy)
{
	d = dd;
	m = mm;
	this->y = yy;                       //illustrate use of this pointer
}

inline void Date::add_year(int n)
{
	y += n;
}

void f() 
{
	Date today;
	today.init(16,10,1996);
	//in this example these output lines do not compile (for example):
	//225a.cpp:8: `int Date::m' is private
     //225a.cpp:44: within this context
	cout << "Today is: " << today.m << "/" 
	     << today.d << "/" << today.y 
	     << endl;
	my_birthday.init(30,12,1950);
	cout << "My Birthday: " << my_birthday.m << "/" 
	     << my_birthday.d << "/" << my_birthday.y 
	     << endl;
	Date tomorrow = today;
	//tomorrow.add_day(1);
}
