Members of an interface

Source: Internet
Author: User

Definition of 15.3.1 interface member

An interface can contain one and more members, which can be methods, properties, index indicators, and events, but not constants, fields, operators, constructors, or destructors, and cannot contain any static members. In the following example, the interface Iexample contains index indicators, event E, method F, and attribute p these members:

Interface Iexample
{
 String This[int index] {get;set;}
      Event EventHandler E;
      void F (int value);
      String P{get;set;}
}

public delegate void EventHandler (Object Sender,eventargs e);

The default access method for interface members is public. An interface member declaration cannot contain any modifiers, such as a abstract,public,protected,internal,private,virtual,override or a static modifier before a member declaration.

The members of an interface cannot have the same name as each other. The inherited member does not need to be declared, but the interface can define a member with the same name as the inherited member, when we say that the interface member overrides the inherited member, which does not cause an error, but the compiler gives a warning. The way to turn off warning prompts is to add a new keyword before the member declaration. However, if you do not overwrite members in the parent interface, the use of the new keyword causes the compiler to issue a warning.

15.3.2 access to Interface members

Full name of the 15.3.3 interface member

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.