Example #1
0
        public static void RunVisitor()
        {
            IVisitor xmlVisitor  = new XmlVisitor();
            IVisitor textVisitor = new TextVisitor();

            Details detail = new Employee("Bill Gates", "12345", "Bill and Melinda Gates Foundation", "CEO");

            detail.Accept(xmlVisitor);
            detail.Accept(textVisitor);

            detail = new Address("98102", "Seattle", "USA");
            detail.Accept(xmlVisitor);
            detail.Accept(textVisitor);

            detail = new Contact("9243110669", "08041893228", "08041893333");
            detail.Accept(xmlVisitor);
            detail.Accept(textVisitor);
        }
Example #2
0
    public static void RunVisitor()
    {
      IVisitor xmlVisitor = new XmlVisitor();
      IVisitor textVisitor = new TextVisitor();

      Details detail = new Employee("Bill Gates", "12345", "Bill and Melinda Gates Foundation", "CEO");
      detail.Accept(xmlVisitor);
      detail.Accept(textVisitor);

      detail = new Address("98102", "Seattle", "USA");
      detail.Accept(xmlVisitor);
      detail.Accept(textVisitor);

      detail = new Contact("9243110669", "08041893228", "08041893333");
      detail.Accept(xmlVisitor);
      detail.Accept(textVisitor);
    }