Use forward declarations
struct MenuOption;
class Menu{
public:
Menu(MenuOption optionlist[],int optioncount);
};
struct MenuOption {
string Text;
int Choice;
bool UseSubMenu;
Menu SubMenu;
};
You don't need to make any data member a pointer. There is no "recursive infinite size" in the above code snippet.
Independent of this, it still looks like a good idea to make that SubMenu
a pointer. Because it does not seem to be required to have a submenu, is it? So you should use a pointer since otherwise that member will always be a menu and needs to be initialized. A pointer can be left uninitialized or as a null pointer. You might also want to use boost::optional<>
instead
struct MenuOption {
string Text;
int Choice;
boost::optional<Menu> SubMenu;
};