Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Can be executed via linqpad : C# Program
- using System;
- // Somewhere in the ether...
- // declaring the interface
- interface IRepairable
- {
- void Repair();
- }
- class WorkerBot : IRepairable
- {
- //Class HAS TO implement the Interface method
- public void Repair()
- {
- Console.WriteLine("Object Repaired!");
- }
- }
- class Program
- {
- //Within the containment class method
- static void Main()
- {
- //create instance of the interface…
- //...but it is interesting you are calling WorkerBot's constructor!
- IRepairable repair = new WorkerBot();
- repair.Repair();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement