I am asking this in response to this answer.
I'm using an example of Variable
and Var
- edit Pls note I am asking where to use Var
or Variable
:
Class NewClass {
private String Variable = "";
Public Class (String Var)
{
NewClass.Var = Variable;
}
}
OR
private String Variable = "";
Public Class (String Variable)
{
NewClass.Variable = Var; // OR WHATEVER OTHER COMBINATIONS IT MAY BE.
}
}
Which ones are the class variables, how does this differ from the parameters and which goes where?
edit
I should add, as this was in the linked answer, but it seems people haven't looked at it:
It's particularly confusing because the parameters to the function have exactly the same names as the class variables, but Patient.ptNo is not the same variable as the parameter ptNo. (Actually, Patient.ptNo should be this.ptNo, because it belongs to this particular instance of the class. Patient.ptNo would refer to a single value that's common to all objects of type Patient.)
So when people say this.Variable = Variable
I am still confused about what is what.