Lecture overview -- Keyboard shortcut: 'u'  Previous page: Examples of Static Factory Methods -- Keyboard shortcut: 'p'    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 29 : 29

Privacy Leaks

Problem: A method can return part of its private state, which can be mutated outside the object

date.cs
A Mutable Date class.
person.cs
A Person class that can return its private date of birth.
Client.cs
A client of the Person which modifies the returned birth Date.
output
The output of the Person client program.
Go to exercise
Privacy Leaks
Go to exercise
Mutable and immutable Point objects with Move methods
Go to exercise
Pyramid BankAccounts