top | item 23269764

(no title)

cordenr | 5 years 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.

discuss

order

mehrdadn|5 years ago

> 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.