Skip to content

Instantly share code, notes, and snippets.

@driscollwebdev
Created May 26, 2011 13:10
Show Gist options
  • Save driscollwebdev/993105 to your computer and use it in GitHub Desktop.
Save driscollwebdev/993105 to your computer and use it in GitHub Desktop.
Interface article sample code 3
class PerishableItem : IProduct
{
#region IProduct Interface Data Members
public string Name { get; set; }
public double Price { get; set; }
public double UnitPrice { get; set; }
public uint SKU { get; set; }
#endregion
//Omitted Code... it's the same as above
}
class NonPerishableItem : IProduct
{
#region IProduct Interface Data Members
string Name { get; set; }
double Price { get; set; }
double UnitPrice { get; set; }
uint SKU { get; set; }
#endregion
}
class Scanner
{
public void Scan(IProduct item)
{
///TODO: Update the inventory database
///TODO: Add the price of this item to the order subtotal
}
public void CancelScan(IProduct item)
{
///TODO: Update the inventory database
///TODO: Subtract the price of this item from the order subtotal
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment