bennyhuo / Bennyhuo

bennyhuo.vercel.app
8 stars 3 forks source link

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

Open bennyhuo opened 5 years ago

bennyhuo commented 5 years ago

https://www.bennyhuo.com/2019/02/18/this-type/?a=2

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