Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. // Can be executed via linqpad : C# Program
  2.  
  3. using System;
  4. // Somewhere in the ether...
  5. // declaring the interface
  6. interface IRepairable
  7. {
  8. void Repair();
  9. }
  10.  
  11. class WorkerBot : IRepairable
  12. {
  13. //Class HAS TO implement the Interface method
  14. public void Repair()
  15. {
  16. Console.WriteLine("Object Repaired!");
  17. }
  18. }
  19.  
  20. class Program
  21. {
  22. //Within the containment class method
  23. static void Main()
  24. {
  25. //create instance of the interface…
  26. //...but it is interesting you are calling WorkerBot's constructor!
  27. IRepairable repair = new WorkerBot();
  28. repair.Repair();
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement