I don't know what the output is, but it's a memorandum. Let's do it without thinking too much because it is better than worrying about how to write it.
It's like a slug thrown into the Dead Sea when I was a student in the first year of IT (?) New graduates and had no computer experience. I'm doing Kuromoto because I want to take JavaSE11Silver, but my personal stumbling block is override and overload. confusing. Didn't the person who named it think so? You wouldn't have thought. There is no human heart. There are about 6 characters and 4 characters are the same, so it would be the same in a majority vote.
Simply 【override】 -A redefined method defined in a superclass so that it can be used in a subclass. By the way, the superclass is the inherited side and the subclass is the inherited side. -The return value, method name, and argument must be the same for the overridden side and the overridden side. -For access restriction levels (public, private, abstract, final, etc.), the overriding side must have looser access restrictions than the overriding side. (The overriding side of the superclass cannot be public and the overriding side of the subclass cannot be private.) -Methods with final cannot be overridden. -When the access modifier of the overridden method is abstract, the method must be overridden. If not, the class itself becomes an abstract class. (By the way, what is the abstract class ...)
【Overload】 -Create multiple methods in the same class with the same method name but different arguments, number of arguments, and arrangement. -If the return value, access level, argument name, and throw clause are different, overloading will not be possible and a compile error will occur.
it seems like.
By the way, if you translate each into English Override rides on ... overload makes it overloaded. Loaded with weight. It seems to mean that
I think it's easier to remember if the override is the image of riding on top of the parent class, and the overload is the image of overloading the same method in the class.
Finally, when I'm writing this article, I can see the preview on the right side, but the readability is deadly low.
Recommended Posts