편집 : 나는 pure virtual function call
오류를 얻고있다순수 가상 함수를 잘못 구현 했습니까?
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.
은, 그래서 내가 구현 잘못이 어쩌면 생각했다.
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)
이 필요합니다 여기에 내가 가진 것입니다.
실제 코드입니까? 두 클래스 중 하나를 정의한 후에는 세미콜론이 없습니다. – hmjd
또한 정의는'int Derived :: f (void)'라고 정의해야합니다. 그러나 언제 오류가 발생합니까? 컴파일러 또는 런타임 오류입니까? '파생 된 '파빌리온이라고 부를 건가요? –
코드는 그대로 (hmjd에 의한 모듈러스) modalo입니다. 어딘가에 또 다른 문제가 있어야합니다. –