Quote:
an_a->bar(); //calls A::bar, but an_a is pointing to a B instance which overloads the bar() method
I can't think of any situation where the above behaviour would actually be useful.
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Quote:
an_a->bar(); //calls A::bar, but an_a is pointing to a B instance which overloads the bar() method
Quote: Original post by Deyja
It's important to remember that public inheritence - what allows for polymorphism - is NOT a tool for code re-use in C++. It models an 'is-a' relationship between the derived and parent classes. Code re-use calls for an 'is-implemented-in-terms-of' relationship, and would use private inheritence or containment.
In short, your argument about Java's 'strange' limitations on interface classes is flawed because your understanding of the concept they represent is flawed.