I\'m new to interfaces and abstract classes. I want to create a couple of interfaces to define core methods and variables for the objects for a shopping cart system. Then I want
In your abstract class, you should define that the return type of the CartItems property, is of type List
.
But, if you really want that the property is of type List
, you can maybe do this:
public interface ICart where TCartItem : ICartItem
{
List CartItems { get; set; }
}
public interface ICartItem
{
}
public abstract class Cart : ICart
{
public List { get; set; }
}
public abstract class CartItem : ICartItem
{
}