virtual base classes in c++

about 5 years ago malczak c++ comments

ive written short piece of code... but it didnt worked. i must write this code down somewhere. im almost sure that next time i will have to deal with virtual inheritance in c++ i will make this mistake once again. lets take a look at this few lines of code :

 1 class A { ... }
 2 class B : public virtual A 
 3 { 
 4  B( void ) : A( void ){ ... }
 5 }
 6 class C : public B 
 7 {
 8  C( void ) : B(void ){ ... }
 9 }

what is wrong ? ive asked myself
well... C class constructor should also invoke direct call to class A constructor. bleh... thats easy, isnt that... not for me hehe

Comments

No comments as yet. Be first to comment.

New comment

  1. (with http or https prefix)

  2. (use [code][/code] tags to post a code snippet)

  3. (javascript is required)

Website content premeditately commited by malczak & sobstel.
Layout by mlando. Icons by dryicons.com. All rights reserved.