I have no updated the question, whilst doing so I realized the scope of the question has completely changed, so I apologize for this. I am dealing with Threads so that static function has to be there. I have tried to abstract the Threading stuff out of the question as much as possible.
私はpure virtual function call
エラーを取得していますので、私は多分、私が実装間違っを持っていると思いました。ここで私が持っているものです。
class Base
{
protected:
virtual int f(void) = 0;
static void baseFunction(void* param);
};
static void Base::baseFunction (void* param)
{
Base *parent = (Base*) parameter;
int i = parent->f();
}
class Derived : public Base
{
private:
int _memeber;
int f(void);
};
int Derived::f(void)
{
_member = 0;
cout << "Derived _memeber is: " << _member << endl;
return 0;
}
void main()
{
Derived d;
d.baseFunction(d);
}
私はDerived
クラスのメンバへのアクセス権を持っている機能Derived::f(void)
を必要としています。あなたは
class Derived : public Base
{
protected:
virtual int f(void);
}
を宣言する必要が
これは実際のコードですか?いずれかのクラスの定義後にセミコロンはありません。 – hmjd
また、定義は 'int Derived :: f(void)'と言うべきです。しかし、あなたはいつエラーを取得していますか?それはコンパイラかランタイムエラーですか? 'Derived 'と呼んでいますか? –
コードはそのままです(hmjdの発言をモジュロにする)、良いです。どこか別の問題があるはずです。 –