コード例 #1
0
 public override void MeatConcrete(Meat meat)
 {
     product.CurentAccountantprice = 69.10;
     product.NewAccountantprice    = product.CurentAccountantprice * 1.30;
     Console.WriteLine("{0} {1}'s new accoutant price: {2:C}",
                       product.GetType().Name, product.Name = "Greendell",
                       product.NewAccountantprice);
 }
コード例 #2
0
 public override void MeatConcrete(Meat meat)
 {
     product.CurentImpostprice = 29.10;
     product.NewImpostprice    = product.CurentImpostprice * 1.20;
     Console.WriteLine("{0} {1}'s new impost price: {2:C}",
                       product.GetType().Name, product.Name = "Grendell",
                       product.NewImpostprice);
 }
コード例 #3
0
        static void Main(string[] args)
        {
            Stock p = new Stock();

            p.Attach(new Meat());
            p.Attach(new Milk());
            ImpostVisitor     impost     = new ImpostVisitor();
            AccountantVisitor accountant = new AccountantVisitor();
            Product           product    = new Product();

            p.Accept(impost);
            p.Accept(accountant);  Console.WriteLine(product.GetType());
            Console.ReadKey();
        }