Google News
logo
Scala - Interview Questions
What are the types of inheritance supported by Scala?
There are various types of inheritance supported by Scala, including single, multilevel, multiple, and hybrid. Single, multilevel, and hierarchy can all be applied to your class. Due to the fact that Scala doesn't allow multiple inheritances, Scala's trait comes into play to deal with the problem. Traits are defined in a similar manner to classes, except that they use the keyword trait rather than the class as shown below:
 trait TraitName  
{
    //Methods
    //Fields
}​
Advertisement