Differences between the implementation interface and the display implementation Interface

Source: Internet
Author: User

There are two methods to implement the inherited interface: A: display the implemented interface, B: (implicit) Implement Interface
It's too difficult to write the article. I am a bit knowledgeable. Please add more. Thank you.
Interface ianimal {
String add (string name );
String Delete (string name );}

Class dog: ianimal
{
# Region ianimal Member
// Implicit implementation Interface
Public String add (string name)
{
Throw new exception ("the method or operation is not implemented .");
}

Public String Delete (string name)
{
Throw new exception ("the method or operation is not implemented .");
}

# Endregion

# Region ianimal Member
// Display implementation Interface
String ianimal. Add (string name)
{
Throw new exception ("the method or operation is not implemented .");
}

String ianimal. Delete (string name)
{
Throw new exception ("the method or operation is not implemented .");
}

# Endregion
}

B: (implicit) implemented Interface
String name = "AA ";
Dog DY = new dog (); // implicit
Dy. Add (name );

A: display implementation Interface
DOG d = new dog (); // display the call method after implementing the interface
// Type conversion is required
(Ianimal) d). Add (name );
Refer:
Http://topic.csdn.net/u/20070822/13/20161194-e05b-4a63-8b3b-51718f16dee8.html
Http://www.cnblogs.com/huashanlin/archive/2006/12/13/591129.html
Http://www.cnblogs.com/ericwen/archive/2007/12/28/1018181.html

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.