Design Patterns - Null Object, Singleton & Composite

Null Node:

Then use the null pattern to write a Null Node.

Our first pattern:

Null Object pattern: Null Object Pattern

Singleton (Gamma p.127)

We now have this null node but who makes it and gets rid of it? It seems like they are all the same. Maybe we should make it a singleton. The static keyword and the scope resolution operator, what they are and how to use them. The scope resolution operator can be used to access a hidden global name.

Now make the non-null subclass:

Composite (Gamma p.163)

Constructors (Stroustrup p.226) and member initializer lists (p.247). Note that empty parens mean funcition and so shouldn't be used. Certian things are initilized to zero, but local varibles arn't. Just assume nothing is.



jwalker@cs.oberlin.edu