how to call the operator* from the derived class nVect of its base class Vect?
class Vect
{
protected:
int v1_;
int v2_;
int v3_;
public:
Vect( int v1, int v2, int v3 );
Vect( const Vect &v);
~Vect();
friend const Vect operator*(Vect& v, int n);
friend const Vect operator*(int n, Vect& v);
};
class nVect : public Vect
{
//private
int pos_;
int value_;
void update();
public:
nVect(int v1, int v2, int v3, int pos, int value);
nVect(const Vect & v, int pos, int value);
~nVect();
friend const nVect operator*(nVect& v, int n);
friend const nVect operator*(int n, nVect& v);
};
Now, the compiler complains at the following code line:
const nVect operator*(nVect& v, int n)
{
return nVect(Vect::operator*(v, n), v.pos_, v.value_);
}
error: ‘operator*’ is not a member of ‘Vect’.
What's wrong?
Thanks all! Jonas