Override and overload

  • Override exists in the inheritance system, which means that the subclass implements a method identical to the method declaration of the parent class;

  • Overload exists in the same class, which means that a method has the same name as an existing method, but at least one of the parameter types, number, and order is different. It should be noted that if the return value is different and everything else is the same, it does not count as overloading.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324621538&siteId=291194637