Abstract modifier, the difference between a specific class and an abstract class

Source: Internet
Author: User

Abstract Modifier
Abstract: A class can be modified to indicate an abstract class. Note: the unique difference between an abstract class and a specific class: A class cannot create objects, but a specific class can create objects.
1. The specific classes have constructor methods, and the abstract classes also have constructor methods.
2. A specific class can have instance attributes, and an abstract class can also have instance attributes.
3. The specific class can have instance methods, and the abstract class can also have instance methods.
4. A specific class can inherit another specific class, and an abstract class can inherit another specific class.


Abstract: A method can be modified to indicate that this is an abstract method, and there is a declaration of the method, which is not implemented.

Abstract classes are specially used for inheritance.

When a class inherits the abstract class, if all the abstract methods in the abstract class are implemented, the class is a specific class.
If a class inherits an abstract class and only implements the abstract methods in the abstract class, the class must be declared as an abstract class.

Abstract modifier, the difference between a specific class and an abstract class

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.