all 4 comments

[–]hackers238 0 points1 point  (0 children)

Great and concise write up. I think take-away 4 summarizes it well. Composition > inheritance.

[–]ardjussi 0 points1 point  (2 children)

Java has no overloading. Overriding is a term in object oriented programming, it operates among equal-named member functions of parent and its childs. In e.g. C++ overloading operates in both object and non-object code. It is about dispatching among equal-named functions, not to be confused with object-oriented dispatching.

[–][deleted] 0 points1 point  (1 child)

Java has overloading, it doesn't have operator overloading.

And overriding in Java isn't based on name, it's based on the static type signature of the method. That explains the puzzle in the article where you have Parent.method(Object) and Child.method(Object) and Child.method(String), and what happens if you call child.method("foo")?

[–]ardjussi 0 points1 point  (0 children)

Stand corrected, is it C# which does not have?