Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
Exactly. You need to check if the class names of both classes are the same. The class name is specific to the actual object, irrespective of subtyping. Any type of casting (whether done with explicit casting or testing with instanceof) allows subtypes to get "through the screen" if you will. For instance, the following will get through: class A { class B extends A { int main(...) { if (a.equals(b)) { -- Dave
Replies: |
Sponsored Links
|