What do you mean by trait in scala and when it is used?
Answer Posted / Ramgopal Singh
A Trait in Scala is a type that contains a certain number of methods, without providing their implementations. It allows for multiple inheritance (mixing) of behaviors. Traits are primarily used when a class needs to reuse code written in other classes. They can be mixed into classes and other traits using with keyword.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers