I have a simple shopping cart model with products that are based on productID, productName, Price, and Stock columns from a database. I then have a productID,ProductName,Price item class that represents the item a customer decides to order. The itemOrder class then refers to the item via productID, ProductName, Price, and quantity via a getPrice method (). The itemOrders are then stored in a Cart class, which contains methods for adding and deleting itemOrders.
Where do OOP principles come into play in any of these classes or in a conventional shopping cart system?
public class Product
{
public int productID { get; set; }
public string productName { get; set; }
...
}
}
public class Item : Product
{
}
public class ItemOrder : Item
{
public int itemQuantity { get; set; }
public double getPrice(int quantity, double price)
{
return price = price * quantity;
}
}
public class Cart
{
}