Interface INotifiable:
namespace exercise76.Models;
internal interface INotifiable
{
public void SendNotification(string notification);
}
Classe Email:
namespace exercise76.Models;
internal class Email : INotifiable
{
public void SendNotification(string notification)
{
Console.WriteLine($"Notification \"{notification}\" sent by email.");
return;
}
}
Classe Sms:
namespace exercise76.Models;
internal class Sms : INotifiable
{
public void SendNotification(string notification)
{
Console.WriteLine($"Notification \"{notification}\" sent by sms.");
return;
}
}
Instâncias:
using exercise76.Models;
Email email = new Email();
email.SendNotification("testing email notification");
Sms sms = new Sms();
sms.SendNotification("testing SMS notifications");