Ok, my use case:
I have two Fragments: PinFragment and PatternFragment. They are used to authorise user with short pin or pattern respectivly. Both have to implement methods such as onLogout(), onUserAuthorised(), onTriesMaxedOut(), etc. Implementation in both are identical. And all those methods use methods from Fragment API (e.q. getActivity()).
fun onLogout(){
getActivity().finish()
}
Inheritance from common class is a good solution, right? Not in this case. As I'm using a not-so-nice library in PatterFragment, I'm forced to enherit from LibraryFragment (class PatternFragment : LibraryFragment{}). I'll probably will have to move to other library, to make it work. However traits/interfaces extending classes would made it possible.
The reason for traits extending classes is avoiding duplication of specific code (here: behavior with authorisation strongly dependent on Fragment) without need to have a common class.