S
stef
Hello,
Could you tell me why did a C++ compiler really need to use a v-table
in this case :
#include <iostream>
using namespace std;
struct A {
virtual void f() { cout << "Class A" << endl; }
};
struct B: A {
virtual void f() { cout << "Class B" << endl; }
};
int main()
{
B x;
A *ptr;
ptr = &x;
// could be "compute" statically ?
ptr->f();
return 1;
}
thanks...
Could you tell me why did a C++ compiler really need to use a v-table
in this case :
#include <iostream>
using namespace std;
struct A {
virtual void f() { cout << "Class A" << endl; }
};
struct B: A {
virtual void f() { cout << "Class B" << endl; }
};
int main()
{
B x;
A *ptr;
ptr = &x;
// could be "compute" statically ?
ptr->f();
return 1;
}
thanks...