Print Test Driver
#include <iostream> #include "printme.h" #include "printme2.h" #include "printmult.h" #include "printmult2.h" using namespace std; void do_print1(PrintMe &pm) { cout << "a by reference: "; pm.print(); cout << endl; } void do_print2(PrintMe pm) { cout << "a by copy: "; pm.print(); cout << endl; } void do_print3(PrintMe *pm) { cout << "a by pointer: "; pm->print(); cout << endl; } void do_print1(PrintMe2 &pm) { cout << "b by reference: "; pm.print(); cout << endl; } void do_print2(PrintMe2 pm) { cout << "b by copy: "; pm.print(); cout << endl; } void do_print3(PrintMe2 *pm) { cout << "b by pointer: "; pm->print(); cout << endl; } main() { PrintMeLots a(3, 3); PrintMeLots2 b(2, 2); /* Just show all the combinations. */ cout << "a direct: "; a.print(); cout << endl; do_print1(a); do_print2(a); do_print3(&a); cout << "\nb direct: "; b.print(); cout << endl; do_print1(b); do_print2(b); do_print3(&b); }