A simple class template
template<class T> class Vector {
public:
Vector(int n0): n(n0), p(new T[n0])
{ }
~Vector() { delete [] p; }
T& operator[](int k)
{ return p[k]; }
private:
int n;
T* p;
};
Previous slide
Next slide
Back to first slide
View graphic version