What is the advantage of having this/self pointer mandatory explicit?

后端 未结 6 1186
死守一世寂寞
死守一世寂寞 2020-12-08 16:04

What is the advantage of having this/self/me pointer mandatory explicit?

According to OOP theory a method is supposed to operate mainly (only?) on m

6条回答
  •  死守一世寂寞
    2020-12-08 16:19

    Eg would be where member names are same as those passed to method

    public void SetScreenTemplate(long screenTemplateID, string screenTemplateName, bool isDefault)
            {
                this.screenTemplateID = screenTemplateID;
                this.screenTemplateName = screenTemplateName;
                this.isDefault = isDefault;
            }
    

提交回复
热议问题