M
Maxim Rogozhin
HI, All!
I've created the following class hierarchy in MS Visual Studio:
class B {
};
class D : public B {
public:
virtual void g();
};
void D::g() {}
and created my object:
D* p = new D;
So far so good. I can see an "B" entry and __vfptr (const
D::'vftable') entry under 'p' entry in "Locals" window, and I can see
an [0x0] entry for function g() under __vfptr.
But if I add a virtual function f() in class B:
class B {
public:
virtual void f();
};
void B::f() {}
class D : public B {
public:
virtual void g();
virtual void f();
};
void D::g() {}
void D::f() {}
then virtual function g() disappears from __vftbl. Moreover - __vfptr
entry has moved under the "B" entry in "Locals" windows (it was under
'p' entry formerly).
So my question is where has my function g() got?? And why __vfptr
moves from 'p' to 'B' ?
Thanks in advance!!!
I've created the following class hierarchy in MS Visual Studio:
class B {
};
class D : public B {
public:
virtual void g();
};
void D::g() {}
and created my object:
D* p = new D;
So far so good. I can see an "B" entry and __vfptr (const
D::'vftable') entry under 'p' entry in "Locals" window, and I can see
an [0x0] entry for function g() under __vfptr.
But if I add a virtual function f() in class B:
class B {
public:
virtual void f();
};
void B::f() {}
class D : public B {
public:
virtual void g();
virtual void f();
};
void D::g() {}
void D::f() {}
then virtual function g() disappears from __vftbl. Moreover - __vfptr
entry has moved under the "B" entry in "Locals" windows (it was under
'p' entry formerly).
So my question is where has my function g() got?? And why __vfptr
moves from 'p' to 'B' ?
Thanks in advance!!!