//public void Play<T>(T t) where T: //{ // Console.WriteLine("This is {0} play {1}", this.Name, lumia.GetType()); // t.Brand(); // t.Call(); // t.Photo(); //} public void PlayPhone(BasePhone phone) { Console.WriteLine("This is {0} play {1}", this.Name, phone.GetType()); phone.Brand(); phone.Call(); phone.Photo(); }
private void button1_Click(object sender, EventArgs e) { BasePhone phone = new BasePhone(); phone.Brand = "Alcatel"; phone.ConnectionType = "Kablolu Telefon"; MessageBox.Show($"Telefonun Türü\t\t : {phone.GetType().Name}\nTelefonun Markası\t\t : {phone.Brand}\nTelefonun Bağlantı Türü\t : {phone.ConnectionType}\nTelefonun sesi\t\t : {phone.Sound()}"); //MessageBox.Show($"{name.PadRight(25)} : {phone.GetType().Name}\n{brand.PadRight(25)} : {phone.Brand}\n{connectionType.PadRight(35)} : {phone.ConnectionType}\n{phoneType.PadRight(25)} : {phone.PhoneType}\n{sound.PadRight(25)} : {phone.Sound()}"); }