Add code examples, and documentation

This commit is contained in:
Aaron Po
2026-08-12 00:03:32 -04:00
commit 77c16e69f6
79 changed files with 4458 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
namespace WithStatePattern.States;
public class Stopped : State
{
public Stopped(Car car)
: base(car) { }
public override void PressGas()
{
Console.WriteLine("The car begins to drive");
Console.WriteLine();
_car.ChangeState(new Driving(_car));
}
public override void TurnKeyClockwise()
{
Console.WriteLine("You hear a grinding noise...");
Console.WriteLine();
}
public override void TurnKeyCounterClockwise()
{
Console.WriteLine("The engine has stopped");
Console.WriteLine();
_car.ChangeState(new Off(_car));
}
}