[Java] [VIDEO] Notes-inheritance

Source: Internet
Author: User

1 overloaded (overload) [Class]: The method name in a class is the same, but the parameters are different.

Override (override) [Inherit]: Must have the same method name, parameter list, and return value as the overridden method.

The overriding method cannot use more restrictive access than the overridden method. That is, overriding method access is larger than overridden methods.

The 2 this keyword represents a reference to an object that uses the method.

This can be seen as a variable whose value is a reference to the current object.

  

3 How to construct in inheritance

If you do not explicitly call the base class construction method in the self-ray construction method, the system defaults to calling the base class parameterless construction method.

If the subclass constructor method does not explicitly call the base class construction method, and there is no parameterless constructor in the base class, the compilation error occurs.

[Java] [VIDEO] Notes-inheritance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.