AIVQ4 - date:date(const date& p dates_in_use day=p.day...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> #include <fstream> using namespace std; class date { public: date(int d, int m, int y); date(const date& p); ~date(void); void write(ostream& out); private: int day; int month; int year; }; int dates_in_use = 0; int main(void) { cout << "number of dates in use = " << dates_in_use << endl; date d(12, 6, 2010); date e(14, 9, 2012); date f(d); return 0; } date::date(int d, int m, int y){ dates_in_use++; day=d; month=m; year=y; cout << "creating the date "; write(cout); cout <<endl<< "number of dates in use = " << dates_in_use << endl;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } date::date(const date& p){ dates_in_use++; day=p.day; month=p.month; year=p.year; cout << "copying the date "; write(cout); cout <<endl<< "number of dates in use = " << dates_in_use << endl; } date::~date(){ dates_in_use--; cout << "destroying the date "; write(cout); cout <<endl<< "number of dates in use = " << dates_in_use << endl; system("pause"); } void date::write(ostream& out) { out << day << "/" << month << "/" << year; }...
View Full Document

This note was uploaded on 02/21/2010 for the course ENGM 2282 taught by Professor Phillips during the Winter '10 term at Dalhousie.

Ask a homework question - tutors are online