First talk about object-oriented 3 features
Encapsulation//is implemented primarily by sealed classes, public/protect/private/internal, with different access levels to control
Inheritance//say is derived
Polymorphism//polymorphism is mainly implemented by override and overload
Override & Overload
Overload called overload, override called override;
Overloading a method is happening in the same class!
Overriding is to override a method in a subclass in a parent class.
1.override:
Parent class: Public virtual string ToString () {return "a";}
Subclass: public override string ToString () {return ' B ';}
In general, when the parent class only provides virtual methods, but the method is used incomplete, or there is no method at all, use the override
2.overload: Available in the same class or in a parent-child relationship class.
public string ToString () {return "a";}
public string ToString (int id) {return ID. ToString ();}
For example, multiple constructors in a class, with default, with parameters
Overrides are virtual methods used to override the base class, which provides a new method in the derived class;
Overloading (overload) provides a mechanism by which the same function names are differentiated by different return value types and parameter tables.
=====================================================
The essential difference is that the function features are the same as the functions of the two functions of overriding (override), although the function names of the two functions of the overloaded (overload) are the same, but the function features are different.
function features include the function name, the type and number of arguments.
Overloading Overload & overriding override