Implement polymorphic hierarchies

Implement polymorphic hierarchies in C++ — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
I need an abstract base class Renderer with a virtual render(Entity const&) and a concrete…
I need an abstract base class Renderer with a virtual render(Entity const&) and a concrete OpenGLRenderer and VulkanRenderer that share a common ResourceManager pointer. Set up constructors, destructors (rule of five where needed), and demonstrate polymorphic use by storing unique_ptr<Renderer> in a vector and invoking render on two different concrete instances in main.

Improve — make it easier to accept

+
Before I hand this to the architecture review, make the polymorphic surface easy to approve: put…
Before I hand this to the architecture review, make the polymorphic surface easy to approve: put the pure virtual methods up front, document ownership of ResourceManager, highlight where slicing or wrong destructor visibility could happen, and call out the simplest refactor to support shared render state across renderer implementations.

Decide — diagnose the stuck moment

+
I changed the ResourceManager in Renderer from a raw pointer to shared_ptr to avoid lifetime bugs.…

I swapped a raw ResourceManager* for shared_ptr and now behavior changed

I changed the ResourceManager in Renderer from a raw pointer to shared_ptr to avoid lifetime bugs. After the change, some resources persist longer than expected and a test that relied on destructor side effects started failing. I need to explain what I changed, who uses Renderer, what I fear (leaks or altered destruction ordering), and ask: what is the likely cause and the best rollback or mitigation while keeping safe ownership?

Become — change the pattern

+
Over several modules I keep choosing different ownership and destructor patterns for polymorphic…

I repeatedly get polymorphism bugs from wrong ownership models

Over several modules I keep choosing different ownership and destructor patterns for polymorphic hierarchies and that creates use-after-free or leaked resources in production. Which habit should I change to stop this cycle: recommend a consistent ownership convention for Renderer-like types, a minimal checklist for virtual destructors and smart-pointer choices, and one code review rule to catch violations early.

Next to this one

Other programming language work people do in C++.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.