Step 6 of 6
Review: class design
Design bugs in class hierarchies are invisible in small tests and expensive in production:
- a base class used polymorphically without a virtual destructor: deleting through a base pointer skips the derived destructor (leaking whatever it owns)
- storing derived objects by value in a container of the base type slices them: only the base part is copied, and virtual calls go to the base version
- an intended override with a slightly different signature (missing
const) silently creates a new function instead.overrideturns that into a compile error
Your turn: this pull request adds weapon logging. Find and fix all three problems so the tests pass.