I've got helped a lot in here.
this is my first time to ask a question. ahead, sorry for my bad English.
I made two classes which is singleton for a project. and its class needs to use other class's functions.
One is app class managing overall app's function and the other one is menu class, which I am trying to add go back function by using stack.
app needs menu, and menu needs app to execute app function when you select a menu numbers.
but error shows up and I have no idea how should i correct it ;_; thank you for your help
this is app.h & app.cpp file
#include <iostream>
#include "Menu.h"
using namespace std;
class App
{
static App app;
App();
public:
static App* GetAppInstance();
Menu* getMenuInstance();
};
#include "App.h"
#include <iostream>
using namespace std;
App App::app;
App::App()
{
cout << "App" << endl;
}
App * App::GetAppInstance()
{
return &app;
}
Menu* App::getMenuInstance()
{
return Menu::getMenuInstance();
}
and this is Menu.cpp and Menu. h file
#include <iostream>
using namespace std;
class App;
class Menu
{
static Menu menu;
Menu();
public:
static Menu* getMenuInstance();
App* getAppInstance();
};
#include "Menu.h"
#include <iostream>
using namespace std;
class App;
Menu::Menu()
{
cout << "메뉴" << endl;
}
Menu * Menu::getMenuInstance()
{
return &menu;
}
App* Menu::getAppInstance()
{
return App::GetAppInstance();
}
Menu Menu::menu