Possible Duplicate:
Does C++ virtual function call on derived object go through vtable?
I have a question regarding c++ virtual table, specifically for gcc. consider following code
class A{
public:
virtual void doSomething(){}
}
class B : public A{
public:
virtual void doSomething(){}
}
//1
A* a = new A()
a->doSomething();
Now the question is, since pointer a is pointing to object of A, does compiler ever bother do lookup in virtual function or is it smart enough to resolve this and get away with virtual table crap.?
thanks