ipavlo

Multiple default methods

Sep 8th, 2021 (edited)
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1. interface IWorker
  2. {
  3.     public void Foo()
  4.     {
  5.         Console.WriteLine("IWorker");
  6.     }
  7. }
  8.  
  9. interface IAnotherWorker
  10. {
  11.     public void Foo()
  12.     {
  13.         Console.WriteLine("IAnotherWorker");
  14.     }
  15. }
  16. class DefaultWorker : IAnotherWorker, IWorker
  17. {
  18. }
  19.  
  20.  
  21.  
  22. //Somewhere
  23. DefaultWorker worker = new DefaultWorker();
  24. worker.Foo();
  25.  
Add Comment
Please, Sign In to add comment