singleton instance defined in the headerfile

hi

Can a singleton's declaration be defined,be defined in a header file the one I've done below? (I know that the function with the instance has to be in a .cpp file but I was just wondering whether the same applied for the instance's interface as shown below)



#define stSTART_MENU CStart_Menu::Instance()
I am not familiar with the CStart_Menu class you use here but of course you can declare it inside a header file.

I am not sure what you want to do with that. Are you sure you don't want typedef instead?
To define stSTART_MENU as CStart_Menu::Instance() .

If that's the case use a syntax like:

typedef stSTART_MENU CStart_Menu::Instance();
the in the tutorial used #define instead, its from this book on ai i bought
Topic archived. No new replies allowed.