1 static int g_next_value = 12345; 2 3 struct VBase { VBaseVBase4 VBase() : m_value(g_next_value++) {} ~VBaseVBase5 virtual ~VBase() {} 6 int m_value; 7 }; 8 9 struct Derived1 : public virtual VBase { 10 }; 11 12 struct Derived2 : public virtual VBase { 13 }; 14 15 struct Joiner1 : public Derived1, public Derived2 { 16 long x = 1; 17 }; 18 19 struct Joiner2 : public Derived2 { 20 long y = 2; 21 }; 22 main(int argc,const char * argv[])23int main(int argc, const char *argv[]) { 24 Joiner1 j1; 25 Joiner2 j2; 26 Derived2 *d = &j1; 27 d = &j2; // breakpoint 1 28 return 0; // breakpoint 2 29 } 30