AbstractCar.cs 734 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace FactoryPattern
  7. {
  8. public abstract class AbstractCar
  9. {
  10. protected abstract void DoOperation();
  11. public void GetInfo()
  12. {
  13. Console.WriteLine($"I am {this.GetType().Name}.");
  14. }
  15. }
  16. public class ConcreateCarA : AbstractCar
  17. {
  18. protected override void DoOperation()
  19. {
  20. throw new System.NotImplementedException();
  21. }
  22. }
  23. public class ConcreateCarB : AbstractCar
  24. {
  25. protected override void DoOperation()
  26. {
  27. throw new System.NotImplementedException();
  28. }
  29. }
  30. }