public Laptop(string model, decimal price, string manufacturer = null, string processor = null, int ram = 0, string graphicCard = null, int hdd = 0, Battery battery = null, string screen = null) : this(model, price) { this.Manufacturer = manufacturer; this.Processor = processor; this.Ram = ram; this.GraphicCard = graphicCard; this.Hdd = hdd; this.Screen = screen; }
static void Main(string[] args) { Battery lion = new Battery("Li-Ion, 4 Cells, 10.8 Volt"); Battery hp = new Battery("HP Compaq, 6 Cells", (float)4.2); Laptop laptop1 = new Laptop("Lenovo Yoga 2 Pro", (decimal)2259.00, "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", 8, "Intel HD Graphics 4400", 128, lion, "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display"); Laptop laptop2 = new Laptop("HP 250 G2", (decimal)699.00); Console.WriteLine(laptop1.ToString()); Console.WriteLine(); Console.WriteLine(laptop2.ToString()); }
public Laptop(string model, string manufacturer, string cpu, string ram, string gpu, string hdd, string display, Battery battery, double price) { this.Model = model; this.Manufacturer = manufacturer; this.CPU = cpu; this.RAM = ram; this.GPU = gpu; this.HDD = hdd; this.Display = display; this.Battery = battery; this.Price = price; }
public Laptop(string model, decimal price, Battery batteryModel) : this(model, price) { this.BatteryModel = batteryModel; }