우지식
우지식

Reputation: 21

some questions about virtual method table in c++

class A {
    public : 
    int a;
    virtual void fun() {}
    virtual void init() {}
};
class B {
    public :
    int b;
    virtual void sum() {}
};
class C : public A, public B{
    public : 
    int c;
    virtual void dud() {
        printf("ccc");}
};

In above Class hierarchy, some book said, pointer for C.dud() is in the VMT for A and C in CIR of C.

but when debugging with visual studio 2010, there is no entry for C.dud() anywhere...

Where is pointer of c.dud() for VMT??

Upvotes: 1

Views: 195

Answers (1)

justin
justin

Reputation: 104708

The vtable is implementation defined. Your book may not match your targeted architecture. You should refer to your system's/architecture's ABI for such information. An example of such a specification: http://refspecs.linux-foundation.org/cxxabi-1.83.html#vtable. Note that this specification (which is for Linux) makes no mention of the acronyms "VMT" or "CIR" (again, because it is implementation defined).

Upvotes: 2

Related Questions