Design Pattern: Visitor Pattern

Visitor pattern moves the operation or calculation part from the element/subject classes to a completely separate class. That separate class is called the visitor. As the operation/calculation is moved to the visitor class, so if we want to change the operation then we can just change the visitor class. No change in the subject classes is required in that case.