2 ms·
Good writeup. What is a checked downcast?
by tomcam 11y ago
Good writeup. What is a checked downcast?
- twoodfin 11y agoIn this context, it's a runtime check inserted by the compiler to be sure that an object retrieved via a generic interface matches the more specific type the caller expects.
- masklinn 11y agoA call from an abstract interface to a concrete type which signals if the concrete type is wrong. In C++, `dynamic_cast` is checked (it returns a null if the cast is incorrect) while the others are unchecked (at runtime, they do have some static checking/limitations, except for C-style casts where there's no check whatsoever)