Explain the difference between a trait and an abstract class?
Answer Posted / Rohit Agrawal
{"Traits": ["Traits in Scala are like interfaces + multiple inheritance. They can contain methods, variables, and other traits. A class adopting a trait inherits all members of that trait."], "Abstract Classes": ["An abstract class is a partially implemented class that cannot be instantiated directly. It contains both concrete (implemented) and abstract (unimplemented) methods. Unlike interfaces, it can contain variables as well."]}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers