Page 28 : 29
Object-oriented Programming in C#
Reference types, Value types, and Patterns
* Reference Types
Reference Types
Illustration of variables of reference types
Overview of reference types in C#
Comparing and copying objects via references
Equality in C#
* Value Types
Value types
Illustration of variables of value types
Structs in C#
Structs and Initialization
Structs versus classes
Examples of mutable structs in C#
Examples of immutable structs in C#
Boxing and Unboxing
Nullable types
* Organization of C# Programs
Program Organization
Examples of Program Organization
Namespaces and Visibility
Namespaces and Assemblies
* Patterns and Techniques
Design Patterns
Object-oriented Design Patterns
The Singleton pattern
A Singleton Random Class
Factory methods
Examples of Static Factory Methods
Privacy Leaks
Examples of Static Factory Methods
In class
Point
it may be relevant to construct both polar and rectangular points
A clumsy attempt with two overloaded constructors.
A better solution with static factory methods.
In struct
Interval
it would be natural to have a parameterless constructor, but it is illegal
A clumsy attempt with two overloaded constructors and an illegal constructor.
A better solution with static factory methods.
Chose a coding style in which
factory methods
are consistently named:
Make...(...)