> Design Patterns > Visitor > Visitor Design Pattern In Ruby

Visitor Design Pattern In Ruby

Visitor design pattern in Ruby to perform operation on elements of an object structure.


Visitor design pattern In Ruby

Output

ConcreteElementA::Accept()
ConcreteVisitor1::VisitConcreteElementA()
ConcreteElementA::Accept()
ConcreteVisitor2::VisitConcreteElementA()
ConcreteElementB::Accept()
ConcreteVisitor1::VisitConcreteElementB()
ConcreteElementB::Accept()
ConcreteVisitor2::VisitConcreteElementB()


Suresh Kumar Srivastava is founder of online learning site coursegalaxy.com and author of popular books C In Depth, Data Structures Through C In Depth. He has 18+ years experience in industry and worked on architecture and design of multiple products. This article Visitor Design Pattern In Ruby is from his Design Patterns course.