赋值期间是否发生隐式指针转换?

does implicit pointer conversion occur during assignment?

例如

int x = 3;
float * ptr = (float*)&x;  // here compiler does not implicitly do conversion, but we have to manually convert to float*   

所以我的问题是,为什么这里我们不需要手动转换它。

Base_Class * ptr = Derived_Class pointer;

此处是否发生隐式转换?

here compiler does not implicitly do conversion

因为intfloatunrelated types。像访问另一个一样访问一个(类型双关语)是未定义的行为。

Why is here implicit conversion occurring

因为通过 base 类型的指针访问派生对象是 runtime polymorphism 工作的基本机制。