namespace klausurentester { internal class Program { public static void Main(string[] args) { handy handy = new handy(); handy.eventt += Nsa.willinformiertwerden; handy.eventt += Stasi.abhören; handy.anrufen("bombe kaufen"); } } class handy // klasse mit Methode die einen string verdoppelt { public delegate void MethodSpeicher(string x); public static event MethodSpeicher eventt; public static void anrufen(string x) { Console.WriteLine($"<{x}> aurufen methode"); if (eventt != null) { eventt(x); } else Console.WriteLine("niemand ist am event registiert"); } } class Nsa { public static void willinformiertwerden(string x) { Console.WriteLine($"NSA wurde informiert + <{x}>"); } } class Stasi { public static void abhören(string x) { Console.WriteLine($"stasi hör dich ab: {x}"); } } }