When are the class brought?

When we do P obj=new C();
then during compiling which class comes in heap?
Is it the P class?

If a parent reference variable is holding the reference of the child class and we have the same data member in both the parent and child class.

Then it will refer to the parent class data member , it doesn’t matter if it is holding child class object reference or not.