Article ID: 143082 - Last Review: July 5, 2005 - Revision: 1.1 FIX: Wrong Pointer Value When Nested Classes Have Same NameThis article was previously published under Q143082 On This PageSYMPTOMS
When a class is derived from multiple classes such that two or more of the
base classes are nested classes of the same name, pointers to either of the
nested base classes point to the same address. Consider a class D which is
derived from both B1::Nested and B2::Nested. Given an object d, which is of
type D, then (B1::Nested *)&d and (B2::Nested *)&d will both resolve to the
same address. If either of the nested base class' names are changed to be
unique, the behavior is normal.
RESOLUTION
This happens only when the nested classes have the same name. Change the
names, for example "A::NestedA" and "B::NestedB".
STATUSThis bug was corrected in Microsoft Visual C++, version 6.0. MORE INFORMATIONSample Code to Reproduce ErrorAPPLIES TO
| Article Translations
|

Back to the top
