Contents Up << >>

Should I normally use pointers to freestore allocated objects for my data members, 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: