Does the interface type inherit from the discussion of System. Object?

Source: Internet
Author: User

I 've been busy recently and haven't been here for a long time. I will often come here to record some of my experiences and experiences.

Many people may be confused when they see the title. They don't think it is necessary to discuss it at all, and think it is boring.

In fact, I only noticed this problem today. Have you ever thought about this problem?

I first encountered this problem by a beginner's programming colleagues. His idea was that the type of excuse seems to be inherited from the System. object, after all, System. object is all.. NET.

In fact, if you think about the above ideas carefully, you can see from the interface definition that the interface is a set of behaviors that can belong to any class or structure.

This concept means that an interface is only an abstract description of a group of actions, and does not include the implementation of these actions. If it inherits from any entity type, the interface includes some specific implementations, that is, if the excuse inherits from the System. object, then every excuse should include System. the implementation of methods such as GetHashCode (), GetType (), and ToString () in the Object is inconsistent with the interface definition and does not comply with the interface design philosophy.

After talking about this, I want to give beginners a wake-up idea. The programming technology sometimes needs to think more and think carefully about the principles behind some things, so that they can improve their own level more quickly.

Conclusion: in fact, the interface type does not inherit any derived class of System. Object or System. Object.

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.