extension function in a kotlin using super

前端 未结 3 1832
后悔当初
后悔当初 2021-01-18 18:06

How to call extension function of the base class in a derived class using the super keyword?

I tried to call using super but it doesn\'t work.

 open         


        
3条回答
  •  心在旅途
    2021-01-18 18:52

    This will do:

    (this as abc).sum()
    

    super does not work as extension functions are not members of the base class to be overridden in derived classes.

提交回复
热议问题