Recently in learning Java, and C + + is a certain difference, the following are more easily confused than the overload, rewrite, refactoring, and its differences with C + +.
About overloading, overriding, and hiding references in C + +: http://blog.csdn.net/zhangjikuan/article/details/38447265
http://blog.csdn.net/zhangjikuan/article/details/38437851
Java:
Overloading: Overloads in Java are the same as C + +
Scope of action: in the same class
Specific: The same method name in the same class, the parameter is different is called overload, for example, a class often have more than one constructor, where the multiple constructors constitute the overload
Note: A constructor is a special case, because the constructor does not return a value, and there is a situation where the other is the same (function name and parameter), but whether the return value is different will not constitute an overload.
No, because the overload is called by different methods depending on the function arguments, but the same return value of the same name and parameter is different so that you don't know which method is invoked at the time of the call, and thus cannot be overloaded.
Rewrite (overwrite): C + + does not have this concept, rewrite is also called overlay, corresponding to the hidden in C + +, covering C + +, but with C + + coverage difference is relatively large.
Scope: base class and derived class
Specific: The name of a function in a derived class is the same as the name of a function in the parent class, but the return value, or cosmetic permission, or parameter is different
Difference: There is more hidden in C + + a case is virtue keyword
Refactoring: Refactoring is the focus of Java, because refactoring forms polymorphism, corresponding to the overlay in C + +
Scope: base classes and derived classes
Specific: The function name parameters in the base class and derived classes return the same value, and only the function body is different, is the basis for the formation of polymorphism
Difference: It is simpler to overwrite than C + +, because overriding the required base class function in C + + is a virtual function, the Java side refactoring does not consider any virtual functions,