Attach variable mesh to socket in C++

I am trying to attach a StaticMeshComponent with a variable StaticMesh to a socket. I can’t find anything relevant to what I am trying to do and, using what I could find, I was still lost. How would I go about doing this?