Add code examples, and documentation
This commit is contained in:
14
patterns/state/WithStatePattern/States/Off.cs
Normal file
14
patterns/state/WithStatePattern/States/Off.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace WithStatePattern.States;
|
||||
|
||||
public class Off : State
|
||||
{
|
||||
public Off(Car car)
|
||||
: base(car) { }
|
||||
|
||||
public override void TurnKeyClockwise()
|
||||
{
|
||||
Console.WriteLine("The engine has started");
|
||||
Console.WriteLine();
|
||||
_car.ChangeState(new Stopped(_car));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user