An idea came into my mind today. Why not just make an implicit(automatic) resource management system instead of having some kind of an external resource management system.
Ever since the way I did it was having an external resource manager that I would then use to create the resource I want. Take a look at this sample code below.
As you can see, we create a texture through a texture resource manager called TextureManager and once we’re done with the texture we go through the TextureManager again to remove that created resource. It’s not really much of a big deal but what if we could just hide the resource management code stuff yet still having all the benefits and convenience of managing your resources? That’s where I thought and said, “Why not just place the manager inside the resource class instead and handle the resource management creation and deletion through the constructor and destructor of the resource respectively?”. hmmm….