| 
    public class GridObject
    {
        private Grid      theGrid;  
        private Location  myLoc;    
        public GridObject(Grid grid, Location loc)
        {
            theGrid = grid;     
            myLoc = loc; 
            ⋮
        }
        public Grid grid()
            { return theGrid; }
        public Location location()
            { return myLoc; }
        public String toString()
            {  }
        protected void addToGrid(Grid grid, Location loc)
            { … }
        protected void removeFromGrid()
            { … }
        protected void changeLocation(Location newLoc)
            { … }
        public void act()
            {  }
    }
 | 
    public class ColorBlock extends GridObject
    {
        
        private Color    theColor;      
        public ColorBlock(Color colorValue,
                          Grid grid, Location loc)
        {
            super(grid, loc);       
            theColor = colorValue;  
        }
        public Color color()
            { return theColor; }
        public String toString()
            {   return theColor.toString() + " "
                        + location().toString(); }
    }
    ColorBlock instance variables:ColorBlock methods:
        grid(), location(), color()toString()
            (redefined method overrides inherited method)
        addToGrid, removeFromGrid, changeLocationact() |