When you cast, you will get the correct class, or nothing at all. Looking at the properties and functions is not needed at all; all it needs to do is walk the chain of parent classes, and compare to the class you cast to. If one of them matches, return that. I can’t think of any reason why a class cast would have to look at properties at all, and, in fact, I can’t even think of an implementation that let you get the right class out of an object that was cast that way.
It is my understanding that, if ClassA and ClassB both have the same properties/functions, but don’t share a base class, you cannot cast an instance of ClassA to ClassB. If you have seen otherwise in the engine source, could you point at a file/line number?
Or are you describing the behavior of interface resolution, not casting? Interfaces can possibly be resolved by matching function names. But there’s still the “implements interfaces” roll-out panel in the class properties, to explicitly list what interfaces you implement.