The base class, "the core", has all the important functions for dispatching the state machine and organizing the state changes. This class must be inherited by all other classes to make them executable as state machines (through the behavioral inheritance).
Let's make an simple illustration of a state machine.
Expand|Select|Wrap|Line Numbers
- [core]--+--[state 1]--+--[state 11]--+--[state 111]
- | +--[state 112]--+--[state 1121]
- | | +--[state 1122]
- | +--[state 113]
- |
- +--[state 12]--+--[state 121]
- | +--[state 122]--+--[state 1221]
- | +--[state 1222]
- | +--[state 1223]
- |
- +--[state 13]--+--[state 131]
- +--[state 132]
But, how do i define a such inheritance (the first level is simple, I have it working already)? All classed have to be in the same state machine, and inherit the "core" functionality directly or indirectly, but without actually creating a new instance of the core! Since there are a lot of branches, I cannot simply create the "highest" layer and let it recursively create all superstates down to the core as the usual way to go would say.
Should I maybe use:
* Friend classes?
* Inheriting without calling super's constructor?
Bonus feature: Substates like '1121' and '1221' (in the illustration) will be very similar in behavior, so it will be great if it's possible to make them descend from the same same (virtual) class and just define the differences for each branch. Will this be as easy as making pancakes thanks to multiple inheritance?
If you don't understand what I'm talking about this far, some reference to "advanced" class inheritance in C++ with examples would probably help me very much :)
Thank you for your time!