Is this a well known design pattern? What is its name?

前端 未结 8 1610
滥情空心
滥情空心 2020-12-06 04:54

I have seen this often in code, but when I speak of it I don\'t know the name for such \'pattern\'

I have a method with 2 arguments that calls an overloaded method t

8条回答
  •  囚心锁ツ
    2020-12-06 05:13

    I agree with @polygenelubricants, but would like to point out that the telescopic pattern can be used apart from overloading. An example is in Objective-C, where method selectors (signatures) must be unique and can't be overloaded.

    - (id)init {
        return [self initWithParam:0];
    }
    
    - (id)initWithParam:(int)param {
        // Do real initialization here!
        return self;
    }
    

提交回复
热议问题