I have 3 classes that derive from one another - GameScreen is the base class to which MenuScreen is derived from. I then have a third class 'TitleScreen' which derives from 'MenuScreen'.
The flow is basically from the base class: 'GameScreen' -> 'MenuScreen' -> 'TitleScreen'
The base class 'GameScreen' has no parameters in it's constructor, like wise with 'TitleScreen', however I need a parameter for 'MenuScreen'. I currently have the header files as:
GameScreen.h
class GameScreen
{
public:
GameScreen();
}
MenuScreen.h
class MenuScreen : public GameScreen
{
public:
MenuScreen(std::string title);
}
TitleScreen.h
class TitleScreen : public MenuScreen
{
public:
TitleScreen(std::string title) : MenuScreen(title);
}
What I'm having difficulty trying to understand is if this is possible in C++ (I'm following a C# sample for Game State Management which does this). Reading through class inheritance in some books I have it only covers parameters inherited from the base class, were as my sample base class has no parameters.