98-372 · Question #27
Which of the following methods is inherited from the ICloneable interface?
The correct answer is B. Clone. The Clone method is a member of the ICloneable interface. The Clone method of the ICloneable interface is used to create a new object that is a copy of the current instance. The Clone method can be implemented either as a deep copy or a shallow copy. In a deep copy, all objects…
Question
Which of the following methods is inherited from the ICloneable interface?
Options
- ACompareTo
- BClone
- CDispose
- DGetType
How the community answered
(45 responses)- A18% (8)
- B71% (32)
- C4% (2)
- D7% (3)
Explanation
The Clone method is a member of the ICloneable interface. The Clone method of the ICloneable interface is used to create a new object that is a copy of the current instance. The Clone method can be implemented either as a deep copy or a shallow copy. In a deep copy, all objects are duplicated; whereas, in a shallow copy, just the top-level objects are duplicated and the lower levels hold references. The resulting clone needs to be of the identical type or a compatible type to the original instance. Answer: C is incorrect. The Dispose method is a member of the IDisposable interface. Answer: A is incorrect. The CompareTo method is a member of the IComparable interface. Answer: D is incorrect. All classes inherit the ToString, Equals, and GetType methods from the base Object class.
Topics
Community Discussion
No community discussion yet for this question.