Program.cs 446 B

12345678910111213141516171819202122
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace StatePattern
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. Car tesla = new Car() {Name = "特斯拉 Model S"};
  13. tesla.Run();
  14. tesla.SpeedUp();
  15. tesla.SpeedDown();
  16. tesla.Stop();
  17. Console.WriteLine();
  18. }
  19. }
  20. }