I came across the following code from this article:
“`kotlin class ExampleFragment : Fragment(), ViewBindingHolder<FragmentExampleBinding> by ViewBindingHolderImpl() {
override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? = initBinding(FragmentExampleBinding.inflate(layoutInflater), this) {
“ This maybe android code, but please am more interested in the kotlin concepts behind this kind of inheritance.
ViewbindingHolderis an interface and
ViewBindingHolderImpl()is a class that has the
ViewbindingHolderinterface implemented. So how are they related to
ExampleFragment`? In java all we have is some interface and a class implementing that interface. what is this, some class implementing an interface and providing it to other class?
submitted by /u/appdevtools
[link] [comments]