InterviewSolution
| 1. |
What is the linearization rule in Scala? |
|
Answer» When a class extends multiple traits, it might happen that they have a common method. Now when that method is executed, it is very important to know the trait on which the method is INVOKED first. The linearization rule says that the common method execution WOULD start in the traits from right to left as it is mentioned in the extends list. Though the class hierarchy is like a graph, the execution of the method stringValue FOLLOWS a particular order based on the linearization rule: |
|