I m new in scala and i wonder what’s the differences between traits and template ?
When should i use template and when should i use traits ?
thanks
I m new in scala and i wonder what’s the differences between traits and
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends what you mean by template.
If it is (wikipedia) the feature that allow functions and classes to operate with generic types, then template and trait are two orthogonal notions.
Traits can use generic type too (see this SO question for instance), but there are here to offer an alternative to multiple inheritance, by offering mixin class composition with stackable behavior.