基本クラス Vect の派生クラス nVect から operator* を呼び出す方法は?
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);
};
ここで、コンパイラは次のコード行で文句を言います:
const nVect operator*(nVect& v, int n)
{
return nVect(Vect::operator*(v, n), v.pos_, v.value_);
}
エラー: 'operator*' は 'Vect' のメンバーではありません。
どうしたの?
皆さんありがとう!ジョナス