GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Unity3DTraining/DesignPatterns/VisitorPattern at master · UnitySample/Unity3DTraining

Expand file tree

/

VisitorPattern

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

VisitorPattern

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
VisitorPattern
VisitorPattern
 
 
README.md
README.md
 
 
VisitorPattern.sln
VisitorPattern.sln
 
 

README.md

Outline

访问者模式

定义

表示一个作用于某对象结构中的各个元素的操作。它使你可以在不改变各个元素的类的前提下定义作用于这些元素的新操作。  

  • 优点:易增加洗的算法即操作集  
  • 缺点:增加新的数据结构变得很困难

小结

访问者模式可以在不改变,某个层级结构的类的前提下,为这个层级结构添加一个新的操作。
访问者模式适用于以下几种情况:

  • 当一个对象结构包含很多类对象,但是它们有不同的接口,并且开发人员希望对这些对象实施一些依赖于具体类的操作时。
  • 当需要为一个对象结构的对象进行很多不同的并且不相关的操作时。
  • 当该对象的结构被很多应用共享时。
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.