Base2 *base2 = new Derived;
// code will be converted to
Derived *temp = new Derived;
Base2 *base2 = temp ? temp + sizeof(base1) : 0;
C++ critiaria - nonstatic member function has to perform no worse than nonmember function.
Actually, compiler will expand nonstatic member function to nonmember function form by
- rewriting the signature of function and passing in this pointer as argument
- access data member using this pointer
- making current function a nonmember function and do "mangling" to get a unique function name
For virtual member function
in multi inheritance situation: