So I'm working on making a finite state machine for an AI class at uni, and I have the weirdest of errors right now, been working on it and nothing seems to get rid of them so hoped someone here can help :)
Basically, in my entity class (the thing that uses the FSM), it doesn't seem to be recognising the State class type, the only thing I could think is the problem now is the order in which I include things but cant seem to get the order right, I know its most likely the smallest of problems, always is so some fresh eyes will be really useful :)
well, it works now :), decided I should just forward declare entity in state as that doesn't do a massive amount with state I don't think
would it be better to forward declare state in entity too or leave that as an include? still a little confused heh, is it only used when there's just a pointer as a parameter or can it be used when you're working with the pointer too?
yeah I know, was just wondering whether the forward declaration is only used when pointers are used as just parameters and return values or if you use them for when you're doing things with pointers or both :)
Forward declaring is used for when you need to resolve a circular dependency at some point, and it works when you use pointers because the compiler doesn't need information about how the class is defined. You do not need to use forward declaring whenever you use pointers; it is used mainly for solving circular dependencies.
In other words, if you use a larger oven to bake a larger cake, you don't need to use larger ovens for all your cakes, just the large cakes.