別のクラス内でクラスを定義するにはどうすればよいですか。以下のコードで。#define "CCompField.h"のように定義しようとしましたが、機能しません。:(。これは非常に一般的なプログラミングの問題だと思います。おそらくインターネット上で100000回解決されたと思いますが、それを見つける方法がわかりません。助けてくれてありがとう。
#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
以下のエラーが発生します。
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