What is multiple interfaces With Example Code

Certainly! In C#, a class can implement multiple interfaces,
allowing it to inherit and implement functionality from multiple sources.




using System;
// Define interface IPrintable
public interface IPrintable
{
    void Print();
}
 
// Define interface IExportable
public interface IExportable
{
    void Export();
}
 
// Define a class named Document that implements both IPrintable and IExportable interfaces
public class Document : IPrintable, IExportable
{
    // Implement IPrintable interface method
    public void Print()
    {
        Console.WriteLine("Printing document...");
    }
 
    // Implement IExportable interface method
    public void Export()
    {
        Console.WriteLine("Exporting document...");
    }
}
 
class Program
{
    static void Main(string[] args)
    {
        // Create an object of Document class
        Document doc = new Document();
        // Call methods from both interfaces
        doc.Print();
        doc.Export();
    }
}