I'm trying to understand what a pointer to an object means. I'm wondering if
class B; //B is incomplete type here
Please explain why sizeof(B*) return 4?
It returns 4 because size of a pointer variable is 4 in your system.
What exactly pointer to object represents in memory?
Objects reside in memory, and pointer to an object contains the starting memory address of that object. For example, if your
B object has size 100 Byte, and it is placed in 1024-1123(100 Bytes) memory location, then a pointer to that object will hold the value `024 (starting address).
Is pointer to sizeof depends on the object type?
I guess you meant does pointer size depends on object type?. No, since pointers contain an address, it's size depends on address space of your system, not type of object it points to.