------------------------------------------------------------------------------
MC logo
PrintMe Test Driver
[^] CSc 220 Home
------------------------------------------------------------------------------
[Introduction] [Boolean and Control] [Functions] [Arrays and Pointers] [Dynamic Arrays] [Array Errors] [Command Array] [Standard Containers] [Structs and Classes] [Automatic Pointer] [Multi-File Programs] [Copying Objects] [Templates] [Inheritance] [Plain C I/O] [Type Odds And Ends] [Plain C Strings] [File I/O]
[Bounded Safe Array] [Bounded Safe Array Driver] [PrintMe Class] [PrintMe2 Class] [PrintMeLots Class] [PrintMeLots2 Class] [PrintMe Test Driver] [Linked List Node Classes] [Linked List Classes] [Linked List Implementation] [Linked List Driver] [Expression Calculator]
pmtest.cc
#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);
}