Hi all,
I've got a noob question to post. I've got this class named "Vector":
I've also got a class named "AssociativeArrayInheritance" that descends form Vector, as you can see:Code:using namespace std; template<class T> class Vector; template<class T> ostream& operator<<(ostream&, const Vector<T>&); template <class T> class Vector { friend ostream& operator<< <>(ostream&, const Vector<T>&); protected: T* data; unsigned len; public: Vector(unsigned = 10); Vector(const Vector<T>&); virtual ~Vector(void); Vector<T>& operator =(const Vector<T>&); bool operator==(const Vector<T>&); T& operator [](unsigned); unsigned getLength(void) {return len;} (...) };
When compiling this file, the last line (line163) ("unsigned i = Vector::getLength ();") is getting me the following error:Code:template<class KeyType, class ValueType> class AssociativeArrayInheritance : public Vector<Pair<KeyType, ValueType> > { public: AssociativeArrayInheritance(unsigned size=0):Vector<Pair<KeyType, ValueType> >(size){} ValueType& operator [](const KeyType); }; template<class KeyType, class ValueType> ValueType& AssociativeArrayInheritance<KeyType, ValueType>::operator [](const KeyType key) { unsigned i = Vector::getLength (); // HOW CAN I CALL THIS METHOD BY INHERITANCE? :| iCAN'T SEEM TO FIGURE OUT... (...)
(all code is in file "vector2.h")
Can anybody help me? I know it must be something stupid & basic but I've searched the web, talked with colleagues, and by now I should be delivering this to S teacher...vector2.h: In member function ‘ValueType& AssociativeArrayInheritance<KeyType, ValueType>:perator[](KeyType)’:
vector2.h:163: error: ‘template<class T> class Vector’ used without template parameters
:



LinkBack URL
About LinkBacks
perator[](KeyType)’:



CornedBee