Is this crufty?
- by bobobobo
I'm writing code like:
class Game
{
int getMouseX()
{
return inputManager.getMouseX() ;
}
} ;
I remember seeing code like this and hating it. One function passes off to another? What is this "pattern" (or, possibly, anti-pattern) called? I don't like it!
On the other hand, it saves exposing the InputManager to the user of the class... would that be a better choice? Or should Game simply not contain InputManager?
Edit
What about using multiple inheritance instead?
class Game : public InputManager, public Window
{
// by virtue of inheriting InputManager and Window,
// Game now has "acquired" the capabilities of
// InputManager's public functions, without requiring delegate.
} ;
Have I not found a reasonably good use for multiple inheritance??