that doesn't give you much info though
and you still have to perform a check to see if it's set or an error message
and you don't know at which stage it error'd
whereas all the featured post functions also take a WP_Post
object
so you could easily call get_the_post_thumbnail( $post_object )
and what if you wanted to throw an attribute on the thumbnail in widget, but not in the main listing
you're now stuck because you cached it earlier
ideally, you'd want to shield all those member variables from the outside world
and expose a method based interface
so really it should be something like $obj->get_featured_image_tag()
which internally calls the WP APIs
whereas right now you're doing 2 things, caching, and trying to simplify the interface for your own purposes
once you've moved to methods, you can make the new object extend an interface and genericise it
for example, I wrote an object that saved me writing raw SQLite queries on a table for a CLI tool
I encapsulated everything, so outside code couldn't see the internal implementation details, and didn't need to know
then I extracted an interface
and implemented a version of the class that uses WPDB
but the code that uses it only type hints on the interface
later on I realised they shared some code, and implemented an abstract class that implemented half the methods
in your case, WP takes care of caching already internally
so it's just helper methods and helpers essentially