Relationship between interfaces and objects

Source: Internet
Author: User

In. in the net world, we often hear nothing more than "system. object is the root of all types and the parent class of all types. in section 8.1 of "net: system. such title as object is system. object To the highest honor. Therefore, based on this point of view, we have the following sentence: "Does the interface inherit from system. Object ?", In fact, this is an episode discussed in the technical group today.

The above is taken from the blog by anytao, author of "You must know. Net". [You must know. Net] 27th: Does the interface actually inherit objects ?".

Below is my understanding:

System. object. However, an interface is not a "thing", a contract, a rule, a virtual concept, or a real "thing". Similar to the law of universal gravitation, it is an abstract idea and cannot be classified as an object.
OK, iobjectable OBJ = new myobject (); actually, a specific object inherited from system. object is instantiated. Why? Because you use class myobject. The class keyword indicates that it must inherit system. object, which is a real object.
The inherited iobjectable interface only complies with its contract and rules and the law of the agreement. Act according to the rules, but the rules themselves are not things and abstract thinking.
In addition, the interface keyword and the class keyword indicate different meanings! You use class, which inherits system. object by default. With the interface, you cannot find the trace of system. object.
Therefore, this conclusion is very simple: the interface itself does not inherit system. object, but its specific implementation (because the class keyword is used) certainly inherits system. object, that is, the author's conclusion 2.
Think about it: can the law of mathematics and the law of universal gravitation count as "things? Or are these objective rules not attached to the task objects?

 

I feel that my answer is pretty good. Haha ...... Record it.

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.