1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
using System; interface IAuthentication { void login(); void logout(); } // class AzureAuth: IAuthentication { private void initAzureStuff() { Console.WriteLine("utilities to ...init Azure stuff"); } public void login() { Console.WriteLine("AzureAuthention LOGIN code"); } public void logout() { Console.WriteLine("AzureAuthention LOGOUT code"); } } class AWSAuth: IAuthentication { private void initAWSStuff() { Console.WriteLine("Amazon init stuff...."); } public void login() { Console.WriteLine("AWS LOGIN code"); } public void logout() { Console.WriteLine("AWS LOGOUT code"); } } public class Program { public static void Main() { Console.WriteLine("Hello World"); // we can switch in and out components that adapt to the interface // like so // AzureAuth autho = new AzureAuth(); AWSAuth autho = new AWSAuth(); // Does not matter whether we use Azure, or AWS // all we care about is login and logout autho.login(); autho.logout(); } } |