Category : C++ Source Code
Archive   : TEACHCPP.ZIP
Filename : EX07022.CPP

 
Output of file : EX07022.CPP contained in archive : TEACHCPP.ZIP

// ex07022.cpp
// Constructors for Arrays of classes
#include

// ------- date class
class Date {
int mo, da, yr;
public:
Date();
Date(int m, int d, int y) { mo = m; da = d; yr = y;}
void display()
{ cout << '\n' << mo << '/' << da << '/' < };

// constructor that is called for each element in a Date array
Date::Date()
{
cout << "\nDate constructor running";
mo = 0; da = 0; yr = 0;
}

main()
{
Date dates[2];
Date temp(6,24,40);

dates[0] = temp;
dates[0].display();
dates[1].display();
}