using System;
// an interface is defined as a syntactical contract that all dervied classes should follow, the interface defines the
// 'what' part of the contract and the deriving classes define the 'how', interfaces define properties, methods, and
// events (members of the interface), interfaces contain only the declaration of the members. it's the responsibility
// of the deriving class to define the members
//
// abstract classes to some extent serve the same purpose, however they are mostly used when only few methods are to be
// declared by the base class and the deriving class implements the functionalities
// a class can inherit from multiple interfaces (see below)
// why not just have method in Customer class w/o the interface (seem like an extra step) -- it's about structure and following rules
public class Program
{
public static void Main()
Customer c = new Customer();
c.Print();
c.Print2();
}
public interface ICustomer
// interface members are public by default (don't need 'public' keyword)
void Print();
// this will throw an error (interfaces can only contain declarations - not implementation)
//void Print() { Console.WriteLine("Hello"); }
public interface ICustomer2
void Print2();
// inherting from two interfaces
public class Customer : ICustomer, ICustomer2
// override isn't needed when implementing method from an interface
public void Print()
Console.WriteLine("interface print method");
public void Print2()
Console.WriteLine("interface print 2 method");