Beispiel #1
0
        static void Main(string[] args)
        {
            ObjectStructure obj = new ObjectStructure();

            obj.Attach(new ConcreteElementA());
            obj.Attach(new ConcreteElementB());
            ConcreteVisitor visitor = new ConcreteVisitor();

            obj.Accept(visitor);

            ReportManager reportManager = new ReportManager();

            reportManager.Attach(new FinancialReport());
            reportManager.Attach(new LogisticsReport());

            FinanceDirector financeDirector = new FinanceDirector();
            SaleDirector    saleDirector    = new SaleDirector();

            reportManager.Accept(financeDirector);
            reportManager.Accept(saleDirector);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            #region Prototype

            var o = new ObjectStructure();
            o.Attach(new ConcreteElementA());
            o.Attach(new ConcreteElementB());
            o.Accept(new ConcreteVisitor1());
            o.Accept(new ConcreteVisitor2());

            Console.WriteLine();

            #endregion Prototype

            var personStructure = new PersonStructure();
            personStructure.Attact(new Man());
            personStructure.Attact(new Woman());

            personStructure.Display(new Success());
            personStructure.Display(new Fail());
            personStructure.Display(new Marriage());

            Console.ReadLine();
        }