コード例 #1
0
        //Метод в который передается аргумент по ссылке
        public void ChangeColor(ref Automobile automobile)
        {
            Console.WriteLine("Введите новый цвет автомобиля");
            string temp = Console.ReadLine();

            automobile._color = temp;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: esim7/home-work-4
        static void Main(string[] args)
        {
            int arrSize = 5;

            Automobile[] array = new Automobile[arrSize];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = new Automobile();
                array[i].Initialization();
            }
            for (int i = 0; i < array.Length; i++)
            {
                array[i].Print();
            }
            Console.WriteLine("Общее количество автомобилей = " + Automobile._carCount + "\n" + "Общая стоимость всех автомобилей = " + Automobile._totalCarPrice + " тенге");
            Console.ReadKey();
        }