关闭。这个问题需要更多focused .它目前不接受答案。
想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post .
4年前关闭。
Improve this question
有没有办法在没有循环依赖的情况下实现访问者设计模式?我的意思是访问者需要一个对象来访问。并且被访问的对象需要访问者接受。最终两者相互依赖。
最佳答案
又找到了!查看 Acyclic Visitor :
引用:
Allow new functions to be added to existing class hierarchies without affecting those hierarchies, and without creating the troublesome dependency cycles that are inherent to the GOF VISITOR Pattern.
关于oop - 访问者设计模式中的循环依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12672543/