The implementation of the volleyball scoring (vi) interface in MVC development

Source: Internet
Author: User

Implementation of the interface

Purpose of the interface:
An interface is a contract, which is a collection of method declarations that encapsulates the behavior (methods) common to some classes.

That is, when you define a method, only the parameter part is written to the end of the semicolon, and there must be some class to implement the interface to make sense.

The implementation of the interface, is in the class in turn the interface in the method of all write complete, that is, each complement the method body (curly braces and the code part inside).

The class that implements the interface can treat it as a subclass of the interface, and the interface can be thought of as their parent class. This can also expand the polymorphic, Richter replacement of the application.

1. What does the interface look like?

Very simple, the general interface is named after the capital letter "I", such as: IComparable, ICar.

2. How do I declare an interface?

Such a format:

Access modifier INTERFAC Interface Name {Some methods of declaration, but do not write the method body, after the parentheses directly followed by a semicolon on the line}

In this volleyball scoring program, most of us can use the system's custom interface

But some interfaces need to be defined by ourselves.

Usingsystem;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;
Using Team.Models.Entities;

namespaceteam.models.interfaces
{
     public interface Icategoryservice
    {
       
        void Ball (CategoryInfo category);
        void Jiafen (int id);
        void Jianfen (int id);
        categoryinfo GetDetail (int id);
        list<categoryinfo> GetAll ();
   }

}

Knowing all of this is basically enough, and my early notes:

Interfaces are declared like classes, where members can contain signatures of methods (implicit public and abstract), properties, events, and delegates.

However, you cannot define data members (fields) and static members in an interface.

Unlike classes, interfaces are simply their declarations and do not provide implementations. The interface is therefore a collection of function declarations.

If a class or struct derives from an interface, the class or struct is responsible for implementing all the members declared in that interface.

An interface can inherit from multiple interfaces, and a class or struct can implement multiple interfaces.

Interfaces can be defined to be written out of the class, without being written together with the declarations of method fields in the class.

The implementation of the volleyball scoring (vi) interface in MVC development

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.