Related to: What does casting do at compiler/machine level?
Let's say I have custom types. Type A is a subtype of Type B.
Originally, my variable is typed ad Type A. Then I cast it to Type B.
Do most compilers, Java's in particular, retain any "memory" of the fact that the variable was once of Type A? And therefore operations that are specific to variable of Type A are still valid for a variable of Type B?
// Thanks all for your comments. Is it possible to call subclasses' methods on a superclass object? - I found my answers here. I don't think I asked the right question originally but everyone's helpful comments led me to thinking about the question in a different way and eventually getting my answers.