Source of testMemoryCell.cpp


  1: //test_memorycell.cpp
  2: //Driver to test the MemoryCell class template.

  4: #include <iostream>
  5: #include <string>
  6: using namespace std;

  8: #include "memorycell.hpp"
  9: //Note that the _t at the end of a .h filename indicates that the
 10: //file contains *both* the specification *and* the implementation
 11: //of the class template.

 13: int main()
 14: {
 15:     MemoryCell<int>    age;
 16:     MemoryCell<string> name("Elvis ");

 18:     age.StoreValue(78);
 19:     name.StoreValue(name.StoredValue() + "Presley");

 21:     cout << endl;
 22:     cout << name.StoredValue() << " would be (is?) "
 23:          << age.StoredValue()  << " years old.";
 24:     cout << endl << endl;
 25: }