Conceptual Doubt about memory

As we saw in P obj= new C();
we had to type caste object of P to object of C to make d2 accessible. In this case what happens to the memory? When we type caste an object to another object, does it create a new object in heap or just give access to d2. Also if we type caste the other objects to c then the data member d print the value of C or P?