Interface Learning (1)

Source: Internet
Author: User
Interface Description

Interface ( Interface ) Is used to defineProgram. The class or structure that implements the interface must be strictly consistent with the interface definition. With this agreement, you can leave it alone.Programming Language(Theoretically ). Interfaces can be retrieved from multipleBasic InterfaceThe class or structure can implement multiple interfaces. The interface can contain methods, attributes, events, and indexers. It cannot be a constant, field, operator, constructor, or destructor, and cannot contain any static member. The interface itself does not provide the Implementation of the members it defines. The interface only specifies the class that implements the interface or the members that the interface must provide. Technically, an interface is a set of data structures that contain functional methods. Through this set of data structures, the customerCodeYou can call the functions of component objects.

the interface is similar to a template. This template defines the methods required for object implementation, the purpose is to enable these methods to be referenced as interface instances . The interface cannot be instantiated. Class can implement multiple interfaces and are indexed through these interfaces. Interface variables can only be indexed to instances of classes that implement this interface.
1 , C # are defined independently of the class .
2 , interfaces, and classes you can inherit multiple interfaces .
3 , a class can inherit a base class., the interface cannot inherit classes at all . C # the simplified interface model helps accelerate application development.
4 an interface defines only abstract members.. C # what an interface actually does is only the method flag, but no code is executed. This implies that one interface cannot be instantiated, and only one object derived from this interface can be instantiated .

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.