The function is only virtual from the first class it's declared virtual and downwards.
Making a function virtual in the parent makes it virtual in the child....
but
Making a function virtual in the child does not make it virtual in the parent.
Sinec 'p' points to a 'base', and 'fun' is not virtual in base, then when you call p->fun(), you get the base version.
but in this case also vtable will be creating as derived class contain virtual function.
derived class will also have vpointer than why is compiler not able to identify correct function.
As per my understanding about virtual table mechanism, compiler extract two byte from the assigne address ( i.e d (derived class object) ) and look for table. as we have table than it should get vtable and resolve this issue.