Posted on 2005-05-14
i have devised a solution to access a superclass arraylist by returning an arraylist of the current arraylist in the superclass.
Is this god programming, is it allowed, is there any other solutions to access the arraylist from the subclass, withought having a protected field.
This is what i was going to use:
public abstract class A
private ArrayList list1;
public ArrayList method1()
my subclass uses method1 from superclass to access the arraylist from the superclass A and print the contents from it:
public class B extends A
public void printlist1()
Iterator it = method1().iterator();
Any help on this subject would be great