Page 34 : 41
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#
Cloning versus use of copy constructors
The fragile base class problem
Factory design patterns
The design pattern Factory Method
The design pattern Abstract Factory
The Visitor design pattern
Natural object-oriented IntSequence traversals
Towards a Visitor solution
A Visitor example: IntSequence
Visitors - Pros and Cons
Factory design patterns
There exists design patterns that insulate clients from the actual instantiation of a class C
Static factory methods
Overview:
Factory methods implemented with class methods (static methods) in C, or in another class
The design pattern
Factory Method
which handles instantiation in instance methods of client subclasses
Relies on instance methods in class hierarchies with virtual methods
The design pattern
Abstract Factory
which is good for instantiation of product families
Relies on instance methods in class hierarchies with virtual methods