I found myself in a situation where I know what type something is. The Type is one of three (or more) levels of inheritance. I call factory which returns B* how
B*
If Derived has Base as a public (or otherwise accessible) base class, and d is of type Derived*, then static_cast(d) is an upcast.
Derived
Base
d
Derived*
static_cast(d)
This is always technically safe.
And generally unnecessary, except for cases where you have hiding (shadowing) of method.
Cheers & hth.,