P
Pierre Couderc
I have a problem with the declaration of virtual function. What do I do
wrong? Why the compiler (MS VC++ 6) says nothing?
It is very simple (see my comment below):
class A
{
public :
A(){;}
};
class B : public A
{
public :
B() : A() {;}
virtual void bad() {;}
};
class C : public B
{
public :
C() : B() {;}
void bad() {;}
};
BOOL CVirtuApp::InitInstance()
{
A* many[2];
C* p = new C;
ASSERT(_CrtIsValidHeapPointer(p));
many[0] = p;
ASSERT(_CrtIsValidHeapPointer(many[0])); // FAILS here
ASSERT(many[0]== p); // OK;
....
}
When the ASSERT fails, I see that the paramter of CrtIsValidHeapPointer
is XXXX at first call and XXXX+4 at second call.
So what am I doing wrong?
Thank you in advance
Pierre Couderc
wrong? Why the compiler (MS VC++ 6) says nothing?
It is very simple (see my comment below):
class A
{
public :
A(){;}
};
class B : public A
{
public :
B() : A() {;}
virtual void bad() {;}
};
class C : public B
{
public :
C() : B() {;}
void bad() {;}
};
BOOL CVirtuApp::InitInstance()
{
A* many[2];
C* p = new C;
ASSERT(_CrtIsValidHeapPointer(p));
many[0] = p;
ASSERT(_CrtIsValidHeapPointer(many[0])); // FAILS here
ASSERT(many[0]== p); // OK;
....
}
When the ASSERT fails, I see that the paramter of CrtIsValidHeapPointer
is XXXX at first call and XXXX+4 at second call.
So what am I doing wrong?
Thank you in advance
Pierre Couderc