Use super class's address/pointer in initialization list

Posted by JQ on Stack Overflow See other posts from Stack Overflow or by JQ
Published on 2010-04-12T05:09:41Z Indexed on 2010/04/12 5:13 UTC
Read the original article Hit count: 321

context 1: class D : public B1, public B2{};

context 2: B2 takes B1 to initialize: B2( B1 * ) //B2's constructor

my question is in D's initialization list:

D::D() : B1(), B2( ? )... What should be in ?

I don't want to put " (B1*)this " in the ? place, because it's no good to use "this" in initialization list. And since B1 part has been initialized, it makes sense to use it.

What should I do ?

© Stack Overflow or respective owner

Related posts about c++

Related posts about multiple-inheritance