C++ & Design Patterns - State

State

Lets get mutability right. Problem: Given a list we would like to insert at the head without knowing what it is. We can do this to non-null list but what about a null list? We need to "change its type." Tada: State to the rescue. Notice that states are completely owned by us so we can delete them ourselves.

See Design Patterns GOF



jwalker@cs.oberlin.edu