bennyhuo / Bennyhuo

bennyhuo.vercel.app
9 stars 3 forks source link

父类返回子类类型的函数写法 | Bennyhuo #26

Open bennyhuo opened 4 years ago

bennyhuo commented 4 years ago

https://www.bennyhuo.com/2019/12/01/this-type/

今天的话题很简单,分享下也许对大家可以有帮助或者有启发。1. 背景一看题目,有点儿晕。看个例子马上就明白了:12345678910abstract class EventBuilder() { protected var retryLimit = 3 fun retryLimit(retryLimit: Int): EventBuilder { thi