ASP. NET learning notes (14)-abstract class and interface

Source: Internet
Author: User

I. abstract classes
1. abstract classes do not have to have abstract attributes and abstract methods. abstract classes must be declared after the abstract methods are declared;
2. The subclass must be an abstract method of the override base class;

2. API www.2cto.com
1. Only methods can be included;
2. The interface cannot contain constants, fields, constructors, destructor, or static members;
3. All members in the interface are set to public by default;
4. Subclass must implement all the members in the interface;
5. A class can implement multiple interfaces separated by commas;
6. An interface can have multiple interfaces. All members of the parent interface must be implemented;

Iii. Differences between abstract classes and interfaces
1. abstract classes are incomplete classes and need to be further refined; interfaces are just a specification or provision of behavior;
2. The method of the abstract class is virtual by default, and the method in the interface is non-virtual by default. It can also be declared as virtual;
By: dxh_0829

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.