what is wrong with the implementation of the add function for the vector class here?
Code:
namespace project {
template <class _T>
class type
{
public :
type();
type(int num);
type( const type & typ);
~type();
protected :
_T val;
};
template <class type, size_t n>
class vector
{
public:
// constructors/destructor
vector( ); // default constructor (size==0)
vector( const vector & vec ); // copy constructor
~vector( ); // destructor
// operator overloads
const vector & operator = ( const vector<type, n>& vec );
// add element to a vector
void add(type value);
vector<type, n>& operator+=(const vector<type, n>& vec);
vector<type, n>& operator-=(const vector<type, n>& vec);
// unary
vector<type, n>& operator-();
// member functions
int length( ) const; // capacity of vector
//read access operator for a polynomial
const type& operator[]( int index ) const;
//write access operator for a polynomial
type& operator[]( int index );
protected:
int csize;
int size; // # elements in array
type * list; // array used for storage
};
template <class type, size_t n>
void vector<type, n>::add(type value)
{
this.list[this.csize] = value;
this.csize++;
}
}