static void Main(string[] args) { MemberProductDiscount productM = new MemberProductDiscount { Price = 2500 }; NormalProductDiscount productN = new NormalProductDiscount { Price = 2500 }; Discount discount = new Discount(); double newPriceMember = productM.Accept(discount); double newPriceNormal = productN.Accept(discount); Console.WriteLine("New price with normal discount is " + newPriceNormal); Console.WriteLine("New price with member discount is " + newPriceMember); Console.ReadKey(); }
public virtual double Visit(NormalProductDiscount normal) { return(normal.Price - normalDiscount); }