An interface is a list of properties and methods that a class must implement.
publicinterface IProduct
{
decimal Price
{
get;
}
void SaveProduct();
}
publicclass MusicProduct : IProduct
{
public decimal Price
{
get { return 12.99m; }
}
publicvoid SaveProduct()
{
// Save Music Product
}
}
publicclass BookProduct : IProduct
{
public decimal Price
{
get { return 23.99m; }
}
publicvoid SaveProduct()
{
// Save Book Product
}
}