- Trait can be viewed not only as interfaces in other languages, but also as classes with only parameterless constructor.
- Whenever there is some code in trait, the trait is called mixin.
- In scala trait, If we create simple class and pass parameter in constructor, without any val or var, it means, that scope of variable is within constructor only, if we specify val or var, it means, the compile create getter for variables.
- If one trait have variable and not initialize with some value, then when we mix with some class, we need to declare that variable in primary constructor with val or var or override in scala otherwise we are getting compile time error.
error: class V3 needs to be abstract, since value messages
in trait V of type String is not defined