How to separate state classes from the state machine class?
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 193
- PR merge metrics
- No merged PRs in 30d
Description
It's been quite some time since I've developed cpp but I'm stuck on trying to separate out the state classes from the State Machine Class's cpp file. No matter how I rearrange the code, I get an `expected class-name before '{' token` error defining the state class.
Using the Elevator example, let's say I wanted to pull out the Panic state class into it's own file. How would I do that?
If I put the panic class into panic.hpp and include it in Elevator.hpp, then I get
```
In file included from elevator.hpp:5,
from elevator.cpp:3:
panic.h:3:1: error: expected class-name before ‘{’ token
3 | {
```
The doc states
> Note that the "elevator" example source code does not declare the states separately, but rather defines the code directly in the declaration.
So my question would be, how _would_ I declare the states separately?
Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.