开发者

problems with overloaded function members C++

开发者 https://www.devze.com 2022-12-24 15:47 出处:网络
I have declared a class as class DCFrameListener : public FrameListener, public OIS::MouseListener, public OIS::KeyListener

I have declared a class as

class DCFrameListener : public FrameListener, public OIS::MouseListener, public OIS::KeyListener  
{
    bool keyPressed(const OIS::KeyEvent & kEvt);
    bool keyReleased(const OIS::KeyEvent &kEvt);

//*******some code missing************************   
};

But if i try defining the members like this

bool DCFrameListener::keyPressed(const OIS::KeyEvent kEvt)
{
    return true;
}

The compiler refuses with this error

error C2511: 'bool DCFrameListener::keyPr开发者_如何学Goessed(const OIS::KeyEvent)' : overloaded member function not found in 'DCFrameListener'  
see declaration of 'DCFrameListener'

Why is this happening, yet i declared the member keyPressed(const OIS::KeyEvent) in my function declaration.

any help will be appreciated. Thanks


The one in the declaration has a reference:

bool keyPressed(const OIS::KeyEvent & kEvt);
                                    ^!
bool DCFrameListener::keyPressed(const OIS::KeyEvent kEvt)
                                                    ^?
0

精彩评论

暂无评论...
验证码 换一张
取 消