My real question is with regards to this question which describes how virtual functions work just in case of object slicing which finish up calling base class virtual function and Wikipedia article which describes the virtual table layout for any derived class for below code

    class A{

     virtual void func(){ cout<<"\n In A:func";}

    class B:public A{

     virtual void func(){ cout<<"\n In B:func";}

    A *ptr1 = new B();

    A oA = *ptr1;


         +0: pointer to virtual method table of B 

       virtual method table of B:
         +0: B::func

Above program results "Inside A::func" .

But exactly how does without virtual table for class B being aware of base class A::func eventually ends up calling A::func

"Virtual table for class B"? Virtual table for class B isn't involved with oA.func() call whatsoever. Object oA has type A, meaning its virtual table is class A.

Furthermore, most compilers will optimize the oA.func() call to ensure that it will not use any virtual tables whatsoever. Since the kind of oA is famous at compile time, the oA.func() call could be immediately forwarded to A::func without needing any virtual tables.

A oA = *ptr1;

This copies any member variables right into a new A object. The vtable pointer isn't a normal member variable and it is not replicated. Thus any subsequent virtual functions known as from this object will behave as if it's a b object, since it is a b object.