#include #include #include "date.h" using namespace std; inline void swap(int *a, int *b) { const int temp = *a; //initialization *a = *b; //assignment *b = temp; } inline void swap(double *a, double *b) { const double temp = *a; *a = *b; *b = temp; } inline void swap(date *a, date *b) { const date temp = *a; *a = *b; *b = temp; } int main() { int i = 10; int j = 20; ::swap(&i, &j); cout << "i == " << i << ", j == " << j << "\n"; double d = 3.14; double e = 2.17; ::swap(&d, &e); cout << "d == " << d << ", e == " << e << "\n"; date today; date tomorrow = today + 1; ::swap(&today, &tomorrow); cout << "today == " << today << ", tomorrow == " << tomorrow << "\n"; return EXIT_SUCCESS; }