Quote (IsraeliSoldier @ Aug 9 2012 04:57pm)
Hiding fields usually relates to inheritance, but making a whole new list is overkill when a simple for loop can do the job.
Quote (tigeranden @ Aug 9 2012 04:48pm)
Isnt that a bad practice as it "hides a field". ?
Doubles is an Instance variable declared in the head of the class.
this probably has nothing to do with inheritance.
i'm guessing tiger's code is
Code
double[] doubles;
somemethod()
{
double[] doubles = new double[10]
}
in which case he's declaring the variable twice. remove one of the declarations
This post was edited by carteblanche on Aug 9 2012 05:44pm