Interfaces : Abstract Class -->Interface-->Implementation. Demonstrates how to set up a basic 3 tier setup of a abstract class, an associated interface, and last, implementation with a class.
//Tier 1 :The abstract class's method definition, where we will later provide an interface for.
/// <summary>
/// Public properties which exposes to inherited class
/// and all other classes that have access to inherited class
/// </summary>
public bool IsThisLogError
{
get
{
return this.logger.IsErrorEnabled;
}
}
// Tier 2 : Providing the interface the abstract class's method.
public interface Ilogger
{
bool IsThisLogError { get; }
}
// Tier 3 : The implementing class's implementation of the interface.
//Assume we have a class 'MyLogger' that implements the interface
ILogger log = new MyLogger();