#include #include #include //for the strcmp function #include "date.h" //for class date using namespace std; //Function declarations: int min(int a, int b); double min(double a, double b); const date& min(const date& a, const date& b); const char *min(const char *a, const char *b); int main() { date today; //no-argument constructor constructs today's date date tomorrow {today + 1}; //operator+(today, 1); cout << ::min(10, 20) << "\n" << ::min(3.14, 2.71) << "\n" << ::min(today, tomorrow) << "\n" << ::min("hello", "goodbye") << "\n"; return EXIT_SUCCESS; } int min(int a, int b) //function definition { if (b < a) { return b; } else { return a; } } double min(double a, double b) { if (b < a) { return b; } else { return a; } } const date& min(const date& a, const date& b) //pass-by-reference avoids copying { if (b < a) { return b; } else { return a; } } const char *min(const char *a, const char *b) { if (strcmp(b, a) < 0) { //if (b < a) { would be wrong for this data type return b; } else { return a; } }