this is used in the constructor, when using a different constructor argument list, if there is another constructor and a constructor function the same, then this constructor can call the constructor function uses
format:
this (value);
class Test
{
Test () {....} / / empty argument constructor
Test (Datatype var) / / constructor with an argument
{
this ()
....
}
Test (Datatype var1, Datatype var2) / / constructor takes two arguments
{
this (var1);
........
}
Test (Datatype var2, Datatype var2, Datatype var3)
{
this (var1, var2);
.......
}
}
=============================================== =================================
this is used in the constructor
format:
this.function (value);
class Test
{
public void function () / / function without parameters
{
function 1;
}
public void function (Datatype var) / / with a function of the parameter
{
function 1;
function 2;
}
public void function (Datatype var1, Datatype var2)
{
function 1;
function 2;
function 3;
......
/ / equivalent to using
/ / this.function (var1); / / ==> Function 1; function 2;
/ / Function 3;
}
}
=============================================== =================================
没有评论:
发表评论