示例#1
0
        static void Main(string[] args)
        {
            operationvirus virus  = new operationvirus(17, "trol", "ilya");//4 реализация этих интерефейсов
            dovirus        virus1 = virus as dovirus;

            virus1.hack();
            Word       mywork = new Word(16, 12, "firstwork", "Google", "kachestvenniy", "laba1");
            NotDovirus virus2 = (NotDovirus)virus;//работа с интерфейсом и его методами

            virus2.hack();
            //5
            Console.WriteLine(virus2.ToString());//вызов переорпделенного метода
            bac dual;

            dual.a = 15;
            dual.b = 30;
            dual.sum();
            Console.WriteLine("Сегодня день недели " + day.thirsday);
            Name myname = new Name("ilya", "alekseev");//партиал в разных файлах

            myname.output();
            Computer a  = new Computer(7);
            TextProc pr = new TextProc(12, 14, "tr", "gr", "regve");
            PO       tt = new PO("greatjob", "bstu");

            a.Add(virus);
            a.Add(mywork);
            a.output();
            a.Del(0);
            a.output();
            a.Add(pr);
            a.Add(tt);
            saper sap1 = new saper("first", "trf", "GGG");
            saper sap2 = new saper("second", "trfy", "Gwefw");

            a.Add(sap1);
            a.Add(sap2);
            Controller gg    = new Controller();
            Computer   ready = gg.SortGame(a);

            ready.output();
        }
示例#2
0
        static void Main(string[] args)
        {
            operationvirus virus  = new operationvirus(17, "trol", "ilya");//4 реализация этих интерефейсов
            dovirus        virus1 = virus as dovirus;

            virus1.hack();
            NotDovirus virus2 = (NotDovirus)virus;//работа с интерфейсом и его методами

            virus2.hack();
            //5
            Console.WriteLine(virus2.ToString());//вызов переорпделенного метода
            Developer[] a = new Developer[4];
            a[0] = new PO("ilya", "bstu");
            a[1] = new OperationWord(5, 20, "doc1", "ff", "hello", "firstdocument");
            a[2] = new saper("firstgame", "lego", "kemperast");
            a[3] = new virus(700, "troyan", "noname");
            Printer k = new Printer();

            k.iAmPrinting(a[0]);
        }
示例#3
0
        static void Main(string[] args)
        {
            operationvirus virus  = new operationvirus(17, "trol", "ilya");//4 реализация этих интерефейсов
            dovirus        virus1 = virus as dovirus;

            virus1.hack();
            Word       mywork = new Word(16, 12, "firstwork", "Google", "kachestvenniy", "laba1");
            NotDovirus virus2 = (NotDovirus)virus;//работа с интерфейсом и его методами

            virus2.hack();
            //5
            Console.WriteLine(virus2.ToString());//вызов переорпделенного метода
            bac dual;

            dual.a = 15;
            dual.b = 30;
            dual.sum();
            Console.WriteLine("Сегодня день недели " + day.thirsday);
            Name myname = new Name("ilya", "alekseev");//партиал в разных файлах

            myname.output();
            Computer a  = new Computer(7);
            TextProc pr = new TextProc(12, 14, "tr", "gr", "regve");
            PO       tt = new PO("greatjob", "bstu");

            a.Add(virus);
            a.Add(mywork);
            a.output();
            a.Del(0);
            a.output();
            a.Add(pr);
            a.Add(tt);
            saper sap1 = new saper("first", "trf", "GGG");
            saper sap2 = new saper("second", "trfy", "Gwefw");

            a.Add(sap1);
            a.Add(sap2);
            Controller gg    = new Controller();
            Computer   ready = gg.SortGame(a);

            ready.output();
            //7 лаба
            Console.WriteLine("Введите исключительную ситуацию, которую хотите увидеть");
            int choise = Convert.ToInt32(Console.ReadLine());

            switch (choise)
            {
            case 1:
            {
                try
                {
                    PO igor = new PO("Игорь", "Игорь");
                }

                catch (exceptionValue1 err)
                {
                    Console.WriteLine("Произошло исключение " + err.value + " " + err.Source);
                }
                finally
                {
                    Console.WriteLine("Блок finally");
                }
            }; break;

            case 2:
            {
                try
                {
                    int[] iskl = new int[2];
                    Console.WriteLine(iskl[3]);
                }
                catch (IndexOutOfRangeException ex)
                {
                    Console.WriteLine("Вы перешли за границу размера массива " + ex.StackTrace);
                }
                finally
                {
                    Console.WriteLine("tHIS IS FINAALY BLOCK");
                }
            } break;

            case 3:
            {
                try
                {
                    int r = 5, b = 0;
                    Console.WriteLine(r / b);
                }
                catch (DivideByZeroException err)
                {
                    Console.WriteLine(err.Message + err.StackTrace + err.HelpLink);
                }
            } break;

            case 4:
            {
                try
                {
                    string str  = null;
                    string read = "Vk";
                    read = read + str;
                }
                catch (Exception err)
                {
                    Console.WriteLine(err.Message);
                }
            } break;
            }

            int[] aa = null;
            Debug.Assert(aa != null, "Values array cannot be null");
        }