I would like to ask how can I define a class inside another. In the code below. I try to define it like this: #define "CCompField.h", but it doesnโt work. :(. I think this is a very common programming problem, it probably was solved 100,000 times on the Internet, but I donโt know how find her. Thanks for the help.
#ifndef CNEWGAME_H #define CNEWGAME_H class CNewGame{ public: CNewGame(); ~CNewGame(); void BeginnerGame(); void IntermediateGame(); void AdviceGame(); void HowToPlay(); void NetGame( int mode ); int MoveInMenu(); protected: void Intro(); void Animation (); void Menu(int); int MoveInNetMenu(); void NetMenu(int); void HeadOfGame(); template <class T> void BodyOfGame(CCompField & b, T & a); void FooterOfGame(); }; #endif
He makes the following mistakes.
In file included from src/CNewGame.cpp:12:0: src/CNewGame.h:37:36: error: 'CCompField' was not declared in this scope src/CNewGame.h:37:45: error: 'b' was not declared in this scope src/CNewGame.h:37:50: error: expected primary-expression before '&' token src/CNewGame.h:37:52: error: 'a' was not declared in this scope src/CNewGame.h:37:53: error: variable or field 'BodyOfGame' declared void
source share