First, the method of rewriting (the override)
Rewrite is the name of a member of a subclass method in the parent class reservations, override a member method of realizing content, change the access member methods or change the members of the return value type.
In succession there is a special overwrite mode, subclass members parent class return value, exactly the same method name, type and number of parameters, the only difference is a method for realizing content, it referred to the weight of this particular embodiment rewritable structure.
Rewrite condition:
- Parameters must be the same, you can modify the method's return value type, but the type of the return value must be compatible
- Access methods can not be reduced
Second, the method of overload (overload)
Method overloading is permitted in the same class with the same name exist more than one method, as long as the number of parameters or different types of methods can
Heavy Load:
- The return type can be different
- You can not only change the return type
- You can change the access rights
Constitute overloaded method:
- Different types of parameters, configuration reload
- Order different parameters, configuration reload
- Number of different parameters, configuration reload