I was recently asked this in an interview. Given the code:
class A{
public:
void f() { cout << "f in A" << endl; }
};
class B : public A{
public:
void g() { cout << "g in B" << endl; }
};
int main()
{
B *p2 = new B;
}
Which function does pointer p2 point to ?
Thanks