CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: Use of this

Threaded View

  1. #3
    Join Date
    Mar 2006
    Location
    Craiova, Romania
    Posts
    439

    Re: Use of this

    Use this when you need to make difference between variables:

    Code:
    public class Form1: Form 
    { 
       private int _someInt; 
    
    
       private void anotherMethod(int _someInt) 
       { 
           this._someInt=_someInt;
     
       } 
    ... 
    }
    Use it when you need to emphazise the belonging to your class of that variable. I suggest to use it only when you need it ( to increase readability and decrease the amount of code), like the situation above.
    Last edited by creatorul; August 9th, 2006 at 04:01 AM. Reason: jhammer I did not see your post :)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured