Difference overload (overloading) and override (rewrite) of

overload (heavy duty):

  

  Overload is a class-based, the same method name, a different parameter list (if the same parameter list, the type of the parameter to be different), and the return value are independent access modifier

  If a direct say in the interview: " the same name in different parameters"  on it

 

 

override (rewrite)

  

  Sons between classes is based on rewriting the same method name, the same parameter list (parameter should remain the same type), or a return value of the same subclass, the access modifier can not access modifier strict parent class, but may be wider than father

  If in the interview directly, said: "with the participation of the same name" on it

father:

Subclass

Guess you like

Origin www.cnblogs.com/LittleBoys/p/12061509.html