using System.Generic.Collections;
public static void Main(string[] args)
Console.WriteLine("Good morning.");
Console.WriteLine("The objects are initialized after this line.");
Console.WriteLine("The SMS message from the 11th youngest owner is below.");
Console.WriteLine("The SMS messages from all 20 items are below.");
Console.WriteLine("The SMS messages from the remaining 10 items are below.");
Console.WriteLine("The objects are disposed after this line.");
Console.WriteLine("Thank you.");
public List<IMobilePhones> CreateInstance()
List<IMobilePhones> list = new List<IMobilePhones>();
for (int i = 0; i < 10; i++)
IMobilePhones cp = new AndroidPhone();
public interface IMobilePhones
public abstract class SmartPhone
protected string _phoneType;
_phoneType = "Smart Phone";
public Guid Id { get; private set; }
public string OwnerUserName { get; set; }
public DateTime OwnerBirthdate { get; set; }
public virtual void SendSms(string message, string ownerUserName, DateTime ownerBirthdate)
Console.WriteLine(message);
Console.WriteLine("Sent from my {0}.", _phoneType);
public class AndroidPhone : SmartPhone, IMobilePhones
_phoneType = "Android Phone";
public override void SendSms(string message, string ownerUserName, DateTime ownerBirthdate)
Console.WriteLine(message);
Console.WriteLine("Sent from my {0}.", _phoneType);
public class IosPhone : SmartPhone, IMobilePhones
_phoneType = "IOS Phone";
public override void SendSms(string message, string ownerUserName, DateTime ownerBirthdate)
Console.WriteLine(message);
Console.WriteLine("Sent from my {0}.", _phoneType);