Should class subobjects be ptrs to freestore allocated objs, or should I use “composition”?
Composition. Your member objects should normally be “contained” in the composite object (but not always; “wrapper” objects are a good example of where you want a ptr/ref; also the N-to-1-uses-a relationship needs something like a ptr/ref). There are three reasons why fully contained member objects (“composition”) has better performance than ptrs to freestore-allocated member objects: • Extra layer to indirection every time you need to access the member object. • Extra freestore allocations (“new” in constructor, “delete” in destructor). • Extra dynamic binding (reason given below).