#include <iostream>
class Core;
class State;
int main() {
std::cin.get();
return 0;
}
class State {
public:
State(Core* core) {
core->setState();
}
};
class Core {
public:
Core() {
State state(this);
}
void setState() {
std::cout << "setting state" << std::endl;
}
};
I keep getting the "use of undefined type" error. I thought that if I forward declare both of the classes, it would fix the problem but I can't figure it out. Is it just silly c++ syntax that I'm missing?