i have a class Bag that has local variables . . . .

private int i=10;
private int [] x;
private int top_pos=0;

class Bag has a get method for an array value, a set method for an array value, a toString override, etc.

i want to make a class BagExt that EXTENDS the Bag class. BagExt will inherit all of Bag's methods, but will override one and maybe overload one (just trying to get familiar with how inheritance works).

so i tried to do the following . . .

public class BagExt extends Bag{

public BagExt (){
super();
}

public void add (int val){
i += val;
}

public int show_i (){
return i;
}

but when i try to compile, i get an error that "i" has private access in Bag. so do i have to declare similar variables of my own? and how is it that the default constructor will work? . . . it uses the Bag private varialbe of "int [] x".

how do i get this to work?

thanks
crq