Answer Posted / Kumar Amit
A Trait in Scala is a partial abstract class that can be mixed into other classes to inherit its members. It allows for multiple inheritance in a more controlled manner than traditional Java interfaces. Traits can contain both abstract methods (without implementations) and concrete methods (with implementations). They are useful for sharing behavior across multiple classes or providing a way to extend functionality without creating a new hierarchy.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers