コード例 #1
0
        // Represent an operation to be performed on the elements of an object structure.
        // Visitor lets you define a new operation without changing the classes of the elements on which it operates.
        //بدون تغییر آبجکت به آن یک عملیات جدید اضافه کرد
        public static void Main(string[] _)
        {
            IStore car = new Car("pride", 10000000000000);

            car.Visit(new PriceVisitor());

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: N0rtus/Patterns
        public static void Main(string[] args)
        {
            IStore car = new Car
            {
                Name  = "BMW",
                Price = 2000000
            };

            car.Visit(new PriceVisitor());

            Console.ReadKey();
        }