cannot instantiate abstract class error

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
alfabeta90
Posts: 52
Joined: Wed Dec 06, 2006 5:18 pm

cannot instantiate abstract class error

Post by alfabeta90 »

Got a 'MyEventReceiver' : cannot instantiate abstract class error when paste following code:

Before main:

Code: Select all

class MyEventReceiver : public IEventReceiver 
{
public:
  virtual bool OnEvent(SEvent event) 
  {
    if (event.KeyInput.Key == KEY_KEY_S && event.KeyInput.PressedDown) 
	{
		cout << "PRESED S\n";
	    return true;
    }
    return false;
  }
};
Into main:

Code: Select all

MyEventReceiver receiver;
	IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(800, 600),32, false, false, false,&receiver);
Tenks for answer.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

If you use Irrlicht 1.4 you have to make the parameter of OnEvent a const-ref: (const SEvent& event)
Post Reply