Article ID: 143109
Article Last Modified on 7/5/2005
/* This code demonstrates the problem.
Compile options needed: none
*/
#include <iostream.h>
// Class definitions
class A
{
protected:
int aint;
public:
virtual void fA(void) = 0;
};
class B
{
protected:
int bint;
public:
virtual void fB(void) = 0;
};
class AB : public A, public B
{
protected:
int abint;
public:
virtual void fAB(void);
};
class DAB : public AB
{
protected:
int dabint;
public:
DAB() {aint = 1; bint = 2; abint = 3; dabint = 4;}
void fA(void)
{
cout << "DAB::fA - this=" << this << endl;
}
void fB(void)
{
// The "this" pointer will be displayed incorrectly in the
// locals window during the execution of this function. The
// address displayed in the output window will still be correct.
cout << "DAB::fB - this=" << this << endl;
// The base class member variables "aint" and "bint" will be
// displayed incorrectly in the locals window, but the derived
// class member variables "abint" and "dabint" will be
// incorrect. All will show correct values in the final output.
cout << "aint: " << aint << " bint: " << bint
<< " abint: " << abint << " dabint: " << dabint <<
endl;
}
};
void AB::fAB(void)
{
cout << "AB::fAB - this=" << hex << this << endl;
fA();
fB();
}
void main()
{
DAB dab;
dab.fAB();
}
Additional query words: kbVC400bug
Keywords: kbbug kbide kbdebug kbcompiler KB143109