Design for container that holds multiple instances of same base class I have four different classes. First being a base class for the second and third. The fourth being a container class that holds instances of second and third (stored as first).

My base class for PC and Companion

public class Controllable
{
    protected String name;
    protected int x;

    public Controllable (String name) {
        this.name = name;
    }

    public void move () {
        x++;
    }
}

public class PC extends Controllable
{
    private int someUniqueVariable;

    public PC (String name, int someUniqueVariable) {
        super (name);
        this.someUniqueVariable = someUniqueVariable;
    }
}

public class Companion extends Controllable
{
    public Companion (String name) {
        super (name);
    }
}


And finally the wrapper/container class.

public class Party
{
    private PC pc;
    private List&lt;Controllable&gt; members;

    public Party () {
        PC = new PC ("PC", 1); // edit #1: should be pc, bad copy-paste
        members = new ArrayList&lt;Controllable&gt;();
        members.add (PC);
        members.add (new Companion ("Companion1");
        members.add (new Companion ("Companion2");
    }

    public moveAll () {
        for (Controllable m : members) {
            m.move();
        }
    }

    public getPC () {
        return pc;
    }
}


Now if I want to move all Controllable I will iterate over members. If there are pc  specifics I will simply call the PC and use its move function. PC will be more separated from Companion later on.

I would mostly like feedback on the design of my code.

Edit #1:

The most critical area were I want feedback is this. Most things are shared between Companion and PC, however there are some unique features of PC. In 99% I want to be able to iterate over all of the party members In more rare cases I want to only access the Companions and sometimes I only want to access the PC.

public Party () {
    pc = new PC ("PC", 1);
    members = new ArrayList&lt;&gt;();
    members.add (PC);
    members.add (new Companion ("Companion1");
    members.add (new Companion ("Companion2");
}


Minor edit to show an error in the code.
Controllable class


can be abstract, it doesn't seem you will instantiate it
int x field shall be private, you don't use it anywhere


Party class


you declared variable of type PC with lower letters so object assignment shall be too pc = new PC ("PC", 1);
members = new ArrayList&lt;Controllable&gt;(); with Java 8 it is not necessary to declare list's type if you do this with variable declaration, so members = new ArrayList&lt;&gt;(); is enough


It is a good practice to make method arguments final, as well class fields if they are provided through constructor. It means their declared type cannot be changed.