Mid
From PDF
OOP
C# OOP
How do interfaces support abstraction?
- By exposing method signatures only, interfaces hide the implementation.
- Allows multiple classes to implement the interface differently, providing flexibility
nd decoupling.
class Bird : IFlyable
{
public void Fly() => Console.WriteLine("Bird is flying");
}
class Airplane : IFlyable
{
public void Fly() => Console.WriteLine("Airplane is flying");
}Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png