Inheritance:
class myClass : protected sf::Sprite {}
In several years of C++ programming, I have not come across a meaningful use case for protected inheritance. Maybe you can tell me one?
When using it as a variable it seems safer, but with inheritance it seems all a lot cleaner and more intuitive:
Assuming
myClass is a logical object like an enemy (use descriptive names), it should encapsulate its attributes. Do not access the sprite directly, but hide it as a private member. Ideally, the interface is kept free from SFML, except for classes like
sf::Vector2f that are not only related to graphics.
The advantage of data encapsulation is the possibility to change the implementation while retaining the interface. If you decide to represent your enemy suddenly with multiple sprites, a shape or a vertex array, and have a inheritance approach or
getSpr() function, you need to refactor every interaction with enemies. If the sprite is hidden, the client code needn't be touched, modifications are local to the implementation of the class.
By the way, these are basic OOP principles, I suggest you read something about that topic