Hacker News new | ask | show | jobs
by cordenr 2215 days ago
Virtual inheritance changes the order that sub-objects are constructed and destructed. This might be used where a base class manages the lifetime of a resource and other types in the hierarchy operate on that - and so need the resource to be "alive" even during their destruction.
1 comments

> This might be used where a base class manages the lifetime of a resource and other types in the hierarchy operate on that - and so need the resource to be "alive" even during their destruction.

Confused, isn't that already the case normally? Base classes are already destroyed after derived classes, and owning pointers die before their targets.