I’m working with a state pattern and are wondering how to define variables so they can use in each child class. A protected variable in the abstract parent class may be the right choice, but with this, I’m wondering how to initialize these variables from the main class.
The example is a code snipped and don't work. I hope it helps to explain my question more accurate.
The quantity of child classes (Step0x) varies, so I think it's easier to define the variable only once in the parent class.
c# variables parent-child abstract