Skip to content

lynxestudio/20170810-ThisKeyword-Sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

The this Reference

Every object can access a reference to itself, called the this reference. The this reference can refer implicitly to the instance variable, properties and methods of an object.

Two uses of the this keyword are:

  1. To resolve ambiguity between instance variables and parameters
  2. To pass the current object as a parameter to another method

The first constructor receives three uint parameters which names are identical to the instance variables of the class. I did this to illustrate explicit use of the this reference.

Fig 1 This reference output


The explicit use of the this reference can increase program clarity in some contexts where this is optional.

About

The this Reference

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages