Page 14 : 37
Object-oriented Programming in C#
Abstract classes, Interfaces, and Patterns
* Method Combination
Method Combination
Parameter Variance
Covariance and Contravariance
* Abstract Classes - Sealed Classes
Abstract Classes
Abstract classes and abstract methods in C#
Abstract Properties
Sealed Classes and Sealed Methods
* Interfaces
Interfaces
Interfaces in C#
Examples of Interfaces
Interfaces from the C# Libraries
Sample use of IComparable
Sample use of IEnumerator and IEnumerable
Sample use of IFormattable
Explicit Interface Member Implementations
* Patterns and Techniques
The Composite design pattern
A Composite Example: Music Elements
An application of Music Elements
Implementation of MusicElement classes
A Composite example: IntSequence
A Composite example: IntSequence application
Implementation of the IntSequence classes
A Composite Example: A GUI
A Composite Example: A GUI
A Composite Example: A GUI
Cloning
Cloning in C#
The fragile base class problem
The Visitor design pattern
Natural object-oriented IntSequence traversals
Towards a Visitor solution
A Visitor example: IntSequence
Visitors - Pros and Cons
Interfaces from the C# Libraries
The C# library contains a number of important interfaces which are used frequently in many C# programs
IComparable
An interface that prescribes a
CompareTo
method
Used to support general sorting and searching methods
IEnumerable
An interface that prescribes a method for accessing an enumerator
IEnumerator
An interface that prescribes methods for traversal of data collections
Supports the underlying machinery of the
foreach
control structure
IDisposable
An interface that prescribes a
Dispose
method
Used for deletion of resources that cannot be deleted by the garbage collector
Supports the C#
using
control structure
ICloneable
An interface that prescribes a
Clone
method
IFormattable
An interface that prescribes an extended
ToString
method
Cloning in C#
The using control structure