A static_cast
forces a conversion that is potentially unsafe.
B* b = static_cast<B*>(a);
This would be valid if a
pointed to an A
object that actually was the base class sub-object of a B
object, however it doesn't. The cast forces the conversion.
B* b = a;
There is no cast here and there is (correctly) no implicit conversion allowed from base class pointer to derived class pointer. A pointer to a derived class can always be converted to a pointer to a base class because a derived class object always contains a base class sub-object but not every base class instance is a sub-object of a particular derived class type.