示例#1
0
        static void Main()
        {
            var mobileList = new List<GSM>();

            Battery nokiaBattery = new Battery("BJ51", 40, 12, BatteryType.LiIon);
            Battery sonyBattery = new Battery("BA900", 30, 15, BatteryType.NiCd);
            Battery samsungBattery = new Battery("EB-L1G6LLA", 30, 15, BatteryType.NiMH);

            Display smallDisplay = new Display(5, 16000000);
            Display mediumDisplay = new Display(7, 16000000);
            Display bigDisplay = new Display(11, 16000000);

            GSM nokiaLumia = new GSM("Lumia630", "Nokia", 300.00, "Microsoft", nokiaBattery, smallDisplay);
            mobileList.Add(nokiaLumia);
            GSM sonyExperia = new GSM("XperiaM", "Sony", 350.00, "Sony", sonyBattery, mediumDisplay);
            mobileList.Add(sonyExperia);
            GSM samsungNote = new GSM("GalaxyNote", "Samsung", 600.00, "Samsung", samsungBattery, bigDisplay);
            mobileList.Add(samsungNote);

            foreach (var phone in mobileList)
            {
                Console.WriteLine(phone.ToString());
            }
            Console.WriteLine(GSM.GetIPhone());
        }
示例#2
0
 public GSM(Display newDisplay, Battery newBattery, string modelOfPhone, string manufacturerOfPhone, decimal price, string owner)
 {
     this.Model = modelOfPhone;
     this.Manufacturer = manufacturerOfPhone;
     this.Price = price;
     this.Owner = owner;
     this.display = newDisplay;
     this.battery = newBattery;
 }
示例#3
0
 public GSM(string model, string manufacturer, double price, string owner, Battery battery, Display display)
 {
     this.MODEL = model;
     this.MANIFACTURER = manufacturer;
     this.PRICE = price;
     this.OWNER = owner;
     this.BATTERYCHARACTERISTICS = battery;
     this.DISPLAYCHARACTERISTICS = display;
 }