Lecture overview -- Keyboard shortcut: 'u'  Previous page: Factory methods -- Keyboard shortcut: 'p'  Next page: Privacy Leaks -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home    Reference types, Value types, and Patterns - slide 28 : 29

Examples of Static Factory Methods
In class Point it may be relevant to construct both polar and rectangular points
Point-before.cs
A clumsy attempt with two overloaded constructors.
Point-after.cs
A better solution with static factory methods.
In struct Interval it would be natural to have a parameterless constructor, but it is illegal
Interval-before.cs
A clumsy attempt with two overloaded constructors and an illegal constructor.
Interval-after.cs
A better solution with static factory methods.
Chose a coding style in which factory methods are consistently named: Make...(...)