Enhanced derived class capability through State object override.
Added the ability to replace an existing State object with a new one. This capability enables derived classes to further customize the state machine while retaining the ability to call on the original state's functionality.