You should just try out the code you posted and see if it works
What you'll probably find, though, is that it won't do what you want. Sprites only hold a pointer to the texture. They don't internally make a copy of the texture themselves. There is only one texture in memory here, so if you change it then it will impact all of your sprites.
An alternative approach is to make one texture that contains all of your images (a "sprite sheet", PlayerAndEnemy.png). After setting the texture on your sprites, call setTextureRect() to only show the desired piece of the texture.