C#. NET Frequently asked Questions (FAQ)-interface interface How to understand

Source: Internet
Author: User

Individuals interpret interface as a special judgment technique, not as a conventional variable type such as judging a string, judging an array, but rather judging whether an instance of the class has certain properties or methods (such as having 10 women wearing the same clothes, covering the head, and letting the groom guess which is his bride, Although this application is seldom seen, but it does exist, Tong Pak-fu in his poetry, and then one of the women reacted, according to which he thought the response is the object he is looking for.

?

In the example program, we declare four kinds of drivers, although from the type of name to know that Danger_driver is illegal driving, but a finer distinction we do not know, such as truck_driver in the end is what kind of unclear, how to declare a unified method Drive_ Judgement, no matter what type of driver passes in, can give you back out what type he is (Driver_judgement can be understood as the same machine as the bride screening machine, no matter what woman, even if the head is covered with red cloth, as long as the machine a check, can determine whether the specified type , we here regardless of fat skinny, adults and children, as long as through this method of a check, you can determine what type of driver's license, can drive what car?

?

The passed-in type of the function is special, is an object (not a specified type, is any type), and then this arbitrary type goes in and attempts to cast to the type of the specified interface (essentially an attempt to cast to the specified type, which is understood to determine whether he has the specified interface, and if so, the conversion is complete, If not, then return null, of course, this application is very special, I did not think of any specific application must do so, for individuals to design this interface is very laborious, read, maintenance is very troublesome, personal not recommended to use)

?

?

For more instructional videos and downloads, please pay attention to the following information:

My Youku Space:

Http://i.youku.com/acetaohai123

?

My online forum:

http://csrobot.gz01.bdysite.com/

?

Problem Exchange:

qq:910358960

Email:[email protected]

?

?

C#. NET Frequently asked Questions (FAQ)-interface interface How to understand

Related Article

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.