Hi, maybe I explained myself wrong in my previous email: what I meant was not that hiding is useless and should be eliminated from Java... my doubt was about the possibility of calling static members from a reference to an object, which is an istantiated entity. In the article I linked it's said that referring static members from object references is a bad style of programming, and it's suggested to call static members using the name of their own class. To avoid potential confusion why isn't this enforced at compile time by the compiler?
Regards, Maurizio Marrocco On Sat, Jul 18, 2009 at 9:11 AM, Vasile Braileanu<[email protected]> wrote: > Hi, > My personal opinion is already in the mentioned article: > > "So what's the difference? > > Briefly, when you override a method, you still get the benefits of run-time > polymorphism, and when you hide, you don't." > > Generally, then you need polymorphism you name the functions with the same > name, to not be confused, by overriding the methods in parent. If you don't > want the polymorphism you can hide the methods (your "implementation" > functions). > Seems logical? > > Best regards, > Vasile Braileanu > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
