Overr ide rewriting and overload Overloading
When an inherited relationship occurs, you can use the super keyword to reference the parent method. If you want to use a new method, you can rewrite it to meet the new function requirements.
The reload is summarized as follows:
•
You can only define different parameter lists when using overload.
•
The returned type, access permission, and thrown exception of the overloaded method cannot be used.
Method overload.
•
The rewrites are summarized as follows:
•
The override method exists in the parent class and also in the subclass.
•
The method of rewriting adopts the form of polymorphism at runtime.
•
The method to be rewritten cannot have higher access restrictions than the method to be rewritten.
•
The method to be rewritten cannot have more exceptions than the method to be overwritten.
The reload is summarized as follows: • different parameter lists can be defined only when reload is used. • Methods cannot be overloaded by the return type, access permission, and thrown exceptions of the overloaded method. • Rewrite is summarized as follows: • The override method exists in the parent class and also in the subclass. • The method of rewriting adopts the form of polymorphism at runtime. • The method to be rewritten cannot have higher access restrictions than the method to be rewritten. • The method to be rewritten cannot have more exceptions than the method to be rewritten.