using System;
// Define an interface with an adjective
interface IFlyable
{
void Fly();
}
// Implement the interface in a class
class Bird : IFlyable
public void Fly()
Console.WriteLine("Bird is flying.");
// Another class that implements the same interface
class Airplane : IFlyable
Console.WriteLine("Airplane is flying.");
class Program
static void Main()
// Create an array of IFlyable objects
IFlyable[] flyingObjects = new IFlyable[]
new Bird(),
new Airplane()
};
// Loop through the array and call the Fly method on each object
foreach (IFlyable flyingObject in flyingObjects)
flyingObject.Fly();