AbstractBus.cs 619 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. namespace FactoryPattern
  3. {
  4. public abstract class AbstractBus
  5. {
  6. protected abstract void DoOperation();
  7. public void GetInfo()
  8. {
  9. Console.WriteLine($"I am {this.GetType().Name}.");
  10. }
  11. }
  12. public class ConcreateBusA : AbstractBus
  13. {
  14. protected override void DoOperation()
  15. {
  16. throw new System.NotImplementedException();
  17. }
  18. }
  19. public class ConcreateBusB : AbstractBus
  20. {
  21. protected override void DoOperation()
  22. {
  23. throw new System.NotImplementedException();
  24. }
  25. }
  26. }