When having an expression that spans over more than one line the compiler might evaluate the expression while avoiding parts of the expression. We can overcome this problem in two ways. This video clip explains this issue.
The Visitor Design Pattern
The visitor design pattern allows us to add operations to objects that already exist without modifying their classes and without extending them.