Interfaces and Abstraction
Interfaces describe what an object can do without dictating its storage or inheritance hierarchy.
How it works
Define capabilities that unrelated types can implement.
The SendAll method depends only on INotifier, making new notification channels easy to add and test.
Runnable C# example
Program.cs
using System;
interface INotifier { void Send(string message); }
class EmailNotifier : INotifier { public void Send(string message) => Console.WriteLine($"Email: {message}"); }
class Program
{
static void Main()
{
INotifier notifier = new EmailNotifier();
notifier.Send("Build complete");
}
}
Email: Build completePractice with the debugger
Set a breakpoint on an important assignment or condition, click Debug, and inspect the local values before stepping to the next line.