简体   繁体   English

C#、. NET中的System.Object

[英]System.Object in C#, .NET

I don't really understand the second question, is my answer to the second question correct ? 我不太了解第二个问题, 我对第二个问题的回答正确吗?

  1. Which of the following is not a method of System.Object? 以下哪个不是System.Object的方法?
  2. What is the most generic (least derived) interface or subclass of System.Object of which it is a method ? 什么是System.Object的方法中最通用的(最少派生)接口或子类
    a. 一种。 GetType() GetType()
    b. b。 ToString() ToString()
    c. C。 Equals(object obj) 等于(对象obj)
    d. d。 Clone() 克隆()

My Answers : 我的答案

Clone() is not a method of System.Object. Clone()不是System.Object的方法。

ICloneable for Clone. 克隆可克隆。 System.Object is the root type, the rest of the methods are its direct members. System.Object是根类型,其余方法是其直接成员。

What is the answer to the second question? 第二个问题的答案是什么? What does it mean? 这是什么意思?

Any advice would be very much appreciated. 任何建议将不胜感激。

Your answer to the first question is of course correct. 您对第一个问题的回答当然是正确的。 Proof . 证明

The second question means, that if you had interface IExtendedCloneable which would derive from ICloneable (had ICloneable as parent interface), it would not be a corect answer, because ICloneable is more generic (less derived) - it is closer to object on the inheritance tree. 第二个问题的意思是,如果您有接口IExtendedCloneable可以从ICloneable派生(必须将ICloneable作为父接口),那么这将不是一个核心的答案,因为ICloneable更通用(派生较少)-它更接近继承object树。

If there wasn't that restriction, you could say that Clone() is a member of System.Windows.Forms.Control.ControlCollection and you would be right, but the answer wouldn't be really relevant. 如果没有这个限制,您可以说Clone()System.Windows.Forms.Control.ControlCollection的成员,那么您是正确的,但是答案实际上并不相关。

Thanks to that restriction, ICloneable is the answer. 由于这一限制, ICloneable就是答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM