Scala traits (similar to interfaces in Java)

Trait can be inherited.
If you use the extends keyword to inherit multiple traits, use with connection.
If the class has both a parent class and a trait, inheritance is still used, but extends is the parent class, with the connection trait

Insert picture description here

Published 1792 original articles · 1136 praises · 960,000 views

Guess you like

Origin blog.csdn.net/a772304419/article/details/105556800