Ejemplo n.º 1
0
        internal static void Main()
        {
            // Setup employee collection
            var employees = new Employees();
            employees.Attach(new Clerk());
            employees.Attach(new Director());
            employees.Attach(new President());

            // Employees are 'visited'
            employees.Accept(new IncomeVisitor());
            employees.Accept(new VacationVisitor());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Main()
        {
            // Setup employee collection
            Employees e = new Employees();
            e.Attach(new Clerk());
            e.Attach(new Director());
            e.Attach(new President());

            // Employees are 'visited'
            e.Accept(new IncomeVisitor());
            e.Accept(new VacationVisitor());

            // Wait for user
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        internal static void Main()
        {
            // Greshno, tai kato ne e rabota na Main metoda da vdiga zaplatatata na employee
            // Zatova se pravi IncomeVisitor, koito ima pravomostiata da ia vdiga
            var employee = new Clerk();
            employee.Income += 1000;

            // Setup employee collection
            var employees = new Employees();
            employees.Attach(new Clerk());
            employees.Attach(new Director());
            employees.Attach(new President());

            // Employees are 'visited'
            employees.Accept(new IncomeVisitor());
            employees.Accept(new VacationVisitor());
        }
Ejemplo n.º 4
0
        private void button6_Click(object sender, EventArgs e)
        {
            Employees empleados = new Employees();
            empleados.Attach(new Director());

            empleados.Accept(new VisitorIngreso());
        }