You need to return the object from your functions and use that as your new object. So
function put(gr,act,loc)
gr.grid{loc.getRow,loc.getCol} = act;
end
Should be
function gr = put(gr,act,loc)
gr.grid{loc.getRow,loc.getCol} = act;
end
And then you can use it like
testGrid = Grid(3,4)
testGrid = testGrid.put(act, loc)
testGrid.get(loc)
And you can also chain the calls
testGrid.put(act, loc).get(loc)