virtual base-class initialization during ctor/dtor

Rule 2 — http://bigblog.tanbin.com/2012/01/dcbc-dtor-execution-order.html shows the dtor sequence. Ctor is the opposite — B-C-D. Let’s call it Rule 2

The exception to Rule 2 is virtual base — Virtual base is constructed before non-virtual bases.

However, this rule still holds —
Rule 1 — dtor / ctor are Always in reverse orders.

Therefore, virtual base is destroyed Last. See http://msdn.microsoft.com/en-us/library/8ff62s5k.aspx

P292 ARM has a concise and complete treatment.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s