struct CBase
{ virtual inline void foo() { puts("base"); }
};
void main()
{ CBase obj;
(&obj)->foo(); // static call or
} // dynamic (using virtual table) call ?
Is it compiler dependend, or does the standart say anything about
wheter the static or the dynamic call is used? With Visual C++ 5.0,
the call is static.
I am asking because I thought that dynamic calls are used in
connection with pointers or references, and (&obj) is a pointer. I
know that the compiler can be smart enough to see that the dynamic
type of the pointer (&obj) will be CBase, and thus use the more
efficient static call.
But I'm curious anyway. What does the standart say about it? In
exactly which cases is the call dynamic?
Thank you for your help
Sensorflo