UnaryInstruction is an abstract class which extends Instruction and has a body which is also an Instruction:
abstract public class UnaryInstruction extends Instruction { protected Instruction body; public void reset(){ super.reset(); body.reset(); } public boolean equals(Instruction inst){ return super.equals(inst) && body.equals(((UnaryInstruction)inst).body); } public Object clone() { UnaryInstruction inst = (UnaryInstruction)super.clone(); inst.body = (Instruction)body.clone(); return inst; } }