L
Lee Garrington
Hey,
Recently I decided to learn C++ so that I could port over one of my Java
programs to make it faster. Basically everything has ported over fine so
far until I came up against the following problem....
The problem involves 2 classes. A Game class and a Solver class. The Game
class updates the game board etc. and the Solver class is called upon when
it needs to solve the board. To do this I have an instance of Solver
declared in Game so that Game can start it when needed and I also have an
instance of Game in Solver so that the solver can call methods in Game to
update the board throughout the solve. I simply cant get it to work though.
I have #ifndef'ed both the .h files but they just cant #include each other
without erroring. This is done no problem in java.
Surely there is a way to do what I want in C++. If there is can someone
please tell me how?
Much appreciated.
Lee
Recently I decided to learn C++ so that I could port over one of my Java
programs to make it faster. Basically everything has ported over fine so
far until I came up against the following problem....
The problem involves 2 classes. A Game class and a Solver class. The Game
class updates the game board etc. and the Solver class is called upon when
it needs to solve the board. To do this I have an instance of Solver
declared in Game so that Game can start it when needed and I also have an
instance of Game in Solver so that the solver can call methods in Game to
update the board throughout the solve. I simply cant get it to work though.
I have #ifndef'ed both the .h files but they just cant #include each other
without erroring. This is done no problem in java.
Surely there is a way to do what I want in C++. If there is can someone
please tell me how?
Much appreciated.
Lee