J
Justin Rogers
Name hiding only works when the developer knows the true type of the
object. For instance, if you pass a NewArrayList that is derived from ArrayList
and try to new any of the methods, then classes that only know the object is
an ArrayList and weren't coded against NewArrayList will call the base methods
rather than the *new* methods.
Virtual inheritance gets over this by grabbing the highest override of a method
in the
list. If you instead override the method in the previous example, then even
code
that works on ArrayList will call the NewArrayList version of the method.
object. For instance, if you pass a NewArrayList that is derived from ArrayList
and try to new any of the methods, then classes that only know the object is
an ArrayList and weren't coded against NewArrayList will call the base methods
rather than the *new* methods.
Virtual inheritance gets over this by grabbing the highest override of a method
in the
list. If you instead override the method in the previous example, then even
code
that works on ArrayList will call the NewArrayList version of the method.