Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- GSM[] test = new GSM[2];
- Display testDisplay = new Display(12, 13);
- Battery testBattery = new Battery(BatteryType.LiIon, 10, 10);
- GSM firstPhone = new GSM("c5-03", "Nokia", 350.99, "Ganio", testBattery, testDisplay);
- test[0] = firstPhone;
- //Оригиналният вариант на конструктора.
- //GSM secondPhone = new GSM("Galaxy S III", "Samsung", 680.99, "Didi", testBattery, testDisplay);
- //Конструктор без стойности за батерия и дисплей.
- GSM secondPhone = new GSM("Galaxy S III", "Samsung", 680.99, "Didi");
- test[1] = secondPhone;
- for (int i = 0; i < test.Length; i++)
- {
- //Ето тук се хвърля изключение - "test[i]" скрито извиква своя метод "ToString()".
- Console.WriteLine(test[i]);
- }
- Console.WriteLine(GSM.IPhone.ModelPhone);
- Console.WriteLine(GSM.IPhone.Manifacturer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement