using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Prog7 { delegate int IntOperation(int a, int b); public class Program { static void Main(string[] args) { System.Collections.Generic.List<Юрист> names = new System.Collections.Generic.List<Юрист>(); names.Add(new Нотариус()); names.Add(new Адвокат()); names.Add(new Судья()); int a = 0; foreach (Юрист s in names) { a++; Console.Write("{0}: ", a); s.Name(); s.Foo(); s.Faa(); } int Sum(int x, int y) { return x + y; } IntOperation op1 = new IntOperation(Sum); int result = op1(a, 10); Console.WriteLine("Сумма № и 10 : " + result); Console.ReadKey(); } } interface Bingo { void Foo(); } interface Ringo { void Faa(); } class Юрист : Bingo, Ringo { public static int b = 0; public virtual void Name() { Console.WriteLine("Юрист"); } public void Foo() { b++; Console.WriteLine("B = " + b); } public void Faa() { b++; } } class Нотариус : Юрист { public override void Name() { Console.WriteLine("Нотариус"); base.Name(); } } class Адвокат : Юрист { public override void Name() { Console.WriteLine("Адвокат"); base.Name(); } } class Судья : Адвокат { public sealed override void Name() { Console.WriteLine("Судья"); base.Name(); } } }