// ---------------------------------------------------------------------------
// TemplateClass.C    A short example of using a template class.
//
// Paul McNamee
// Introduction to C++ Programming, 605.201
// ---------------------------------------------------------------------------

#include <iostream.h>

template <class T>
class Foo {
  public :
    T x ;
    Foo (T arg) {
      x = arg ;
      }
    void Print () {
      cout << x << endl;
    }
} ;

int main () {
  Foo<int> i(-7) ;
  Foo<float> f(5.6) ;
  Foo<char *> str("A string");

  i.Print();
  f.Print();
  str.Print();

  return i.x;
}

// ---------------------------------------------------------------------------
// Some output:
//
// paulmac@nautilus: CC -o TemplateClass TemplateClass.C
//
// paulmac@nautilus: TemplateClass
// -7
// 5.6
// A string
 
