C # contains function numbers, abstraction, and interface statement description

Source: Internet
Author: User
Function number: it is specified by virtual machines. It allows duplicated classes in the derived classes. to reproduce a method, you must first name it virtual.
Public class myclass
{
Public Virtual int Myint ()
{
Function body;
}
}
Class myclass1: myclass
{
Public override int Myint ()
{
Function 1;
}
}

Abstract class and abstract function: abstract methods can define abstract methods in abstract classes. abstract methods do not have any linear substitution. to derive a class, you must repeat it, provides its primary line replacement
Public abstract class myclass
{
Public abstract int Myint ();
}
Public class myclass1: myclass
{
Public override int Myint ()
{
Function body;
}
}

Interface Type: It is a special abstract type identified by interface. It is a combination of methods, features, events, and indexes. No field exists, and its members have no rows, there is no structure of the number of letters, and it does not allow the operator to repeat. The interface and its members do not have any operator modifier, and it is always public, it cannot be specified as implicit or implicit notation. All methods in the interface must be implemented for derived classes of the interface.
Interface imyinterface
{
Void myfunction ();
String name
{
Get;
Set;
}
}
Class myclass: imyinterface
{
Void myfunction ()
{
Function body;
}
String name
{
Get
{
Return name;
}
Set
{
Name = value;
}
}
}

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.