C # 's interface interface

Source: Internet
Author: User

Interfaces in C # are very similar to abstract classes, and they cannot instantiate their own objects, but they also have important differences. In interface and abstract class, classes cannot inherit multiple, but interfaces can inherit multiple.

This code indicates that the method of declaring the interface and the inherited interface are implemented without the defined method

In addition, a class can inherit multiple interfaces, so that all functions in the interface will be re-implemented once.

The interface can also be extended so that the previously defined interface can be reused. As follows:

This allows you to inherit from the class by isorableadd instead of using isorable.

Interface polymorphism (polymorphism with Interface).

Display the implementation of the interface:

This is the implementation of the display. The function to invoke the display implementation is to display the conversion. The implementation shown can prevent these functions from being exposed

Can only be obtained by conversion and cannot be instantiated.

C # 's interface interface

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.