X hits on this document

815 views

0 shares

0 downloads

0 comments

293 / 396

C# LANGUAGE SPECIFICATION

namespace System { public interface ICloneable { object Clone(); } }

Here, the fully qualified name of the Clone method is System.ICloneable.Clone.

13.4 Interface implementations

Interfaces may be implemented by classes and structs. To indicate that a class or struct implements an interface, the interface identifier is included in the base class list of the class or struct. For example:

interface ICloneable { object Clone(); }

interface IComparable { int CompareTo(object other); }

class ListEntry: ICloneable, IComparable { public object Clone() {...}

public int CompareTo(object other) {...} }

A class or struct that implements an interface also implicitly implements all of the interface’s base interfaces. This is true even if the class or struct doesn’t explicitly list all base interfaces in the base class list. For example:

interface IControl { void Paint(); }

interface ITextBox: IControl { void SetText(string text); }

class TextBox: ITextBox { public void Paint() {...}

public void SetText(string text) {...} }

Here, class TextBox implements both IControl and ITextBox.

13.4.1 Explicit interface member implementations

For purposes of implementing interfaces, a class or struct may declare explicit interface member implementations. An explicit interface member implementation is a method, property, event, or indexer declaration that references a fully qualified interface member name. For example

280Copyright Microsoft Corporation 1999-2003. All Rights Reserved.

Document info
Document views815
Page views815
Page last viewedSun Dec 04 06:49:51 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments