lundi 23 octobre 2017

Static methods and inheritance

So i'm using an MVC design pattern to manage my scenes in my game.

I have an object named GameLoop with a method called "LoadView" which accepts an object called GameView. When LoadView is called, it stores the scene in a member variable, and subscribes event handlers to a GLFW window object.

both LoadView and ViewController are abstract classes which will be inherited by individual views and controller objects. The controller contains all the necessary event call backs for the Window, however GLFW only accepts static methods as event handlers.

My question is this; If I load an object which inherits GameController from a method that takes in an abstract GameController class, and I try to access its overloaded on_keypress_event, will it call the on_keypress_event defined by the parent or the abstract object?

I'm basically trying to figure out how to overload a static method.

Should I use a function pointer to grab the handler and subscribe it to the window?

Aucun commentaire:

Enregistrer un commentaire