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

前端 未结 8 1590
滥情空心
滥情空心 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:04

    No, this is not a design pattern in the gang of four sense, but it is common in many languages that do not allow default parameters.

    In a language like ruby you could do something similar as follows

      def dowork(name, phoneNumber, emailAddress = '')
        # code here
      end
    

提交回复
热议问题