static_cast , and C-style are programmerโs methods that explicitly request type conversion. Your example is a standard implicit conversion, which is described separately, and not in terms of explicit conversions.
Your example is known as derivative conversion and is defined in the standard [conv.ptr]/2 :
N3337: A value of type "pointer to cv D ", where D is a class type, can be converted to prvalue of type "pointer to cv B ", where B is the base class of D If B is an unreachable or ambiguous base class D , a program that requires this conversion is poorly formed. The result of the conversion is a pointer to a subobject of the base class of the derived class object. The null pointer value is converted to the null pointer value for the destination type.
In other words, a D* always implicitly converted to B* with the same const and volitile .
Tartanllama
source share