P.S. Take a look at this FAQ for a clarification of terminology and why it is wrong to say something "gains heat": https://www.physicsforums.com/showthread.php?t=511174
I think he's talking about heat-expansion and how a body that's not allowed to expand still get hotter.
The trick here is that all objects are at least somewhat compressible. Increasing temperature without allowing to expand is equivalent to heating the object up and then compressing it to original size. (In terms of forces involved.)