3 ms·
In Java, IIRC, the cast fails with a ClassCastException. That seems to me to be "failure is reflected at runtime". In C++ with RTTI, IIRC it returns null. Th
by AnimalMuppet 12y ago
In Java, IIRC, the cast fails with a ClassCastException. That seems to me to be "failure is reflected at runtime".
In C++ with RTTI, IIRC it returns null. That's also "failure at runtime" (of a sort), but you have to check it.
- jeorgun 12y agoRTTI returns nullptr when casting a pointer, but it does throw an exception when casting references. Both of these behaviors are well-defined, although the first is kind of questionable.