two syntax-related C++ questions
Posted on 1998-05-12
I am a little bit confused on some syntax in C++, yet I do not have a C++ reference book at hand... So please help if you can...
I declared my class (Vector) like following:
template <class T>
void append(T& obj); // add one element to the end of vector
T& operator(long index);
The implementation is omitted('cos I don't think it is related to the problem).
The following code attemps to use the Vector class:
However, I got the following two errors:
error C2664: 'void Vector<int>::append(int &)' : cannot convert parameter from 'const int' to 'int &'
error C2666: '' : 2 overloads have similar conversions
Can anyone tell me how to correct these errors? Thanks!