Click on main3.cpp to get source.

// File: C++Examples/Lists/main3.C
//   This is the C++ implementation of ../CExamples/Lists
//   Note: the original C program was rewritten to reflect
//         modern C++ principle (it would work as written)
//         those "modern" C++ principles are explained as
//         demo'd concepts in the comments


#include <iostream>
#include <iterator>
#include "prof3.h"

using namespace std;

ostream& operator<<(ostream& os, const PROF& professor)
{os << professor.lname << " " << professor.fname;
 return os;
}// end operator<<(ostream&, const PROF&)

template< typename PROF_CONTAINER >
ostream& operator<< (ostream& os, const PROFLIST< PROF_CONTAINER >& L)
{ostream_iterator<PROF> out(os, "\n");
 copy(L.begin(), L.end(), out);
 // concepts demo'd: STL copy algo used with ostream_iterator for output
 return os;
}// end operator<< <PROF_CONTAINER>

template // instantiate template class
class PROFLIST< set<PROF> >;

int main(int argc, char* argv[])
// there are no args to main, but for later use always define these
{PROF  caviness("Caviness", "Bob",     'F', 100.0, 1, 4.5)
      ,kaltofen("Kaltofen", "Erich",   'L',  50.0, 1, 3.0)
      ,saunders("Saunders", "Benjamin",'D',  95.0, 2, 3.5)
      ; // initialization is by constructor args

 PROFLIST< list<PROF> > L;
 PROFLIST< set<PROF> > L2;

 L.hire(caviness);
 // hire and fire are mem funs of PROFLIST
 // the have a reference arg, so no pointer to PROF passed in
 
 cout << L << endl;
 // cout << is the standard way to "serialize" objects to a stream
 
 L.hire(saunders); cout << L << endl;
 L.hire(kaltofen); cout << L << endl;
 
 L.fire("Kaltofen"); cout << L << endl;
 L.fire("Caviness"); cout << L << endl;
 L.fire("Pipes"); cout << L << endl;

 cout << "--------" << endl;

 L2.hire(kaltofen);cout << L2 << endl;
 L2.hire(saunders);cout << L2 << endl;
 L2.fire("Kaltofen"); cout << L2 << endl;

 return 0;
}// end main