Design Patterns Java™ Workbook

(Michael S) #1
Chapter 26. Introducing Extensions

os.setRandomCase();
os.setTitleCase();
System.out.println(os);
}
}


Figure 26.6. In this questionable design, the OoString class extends the String class,
delegating certain operations to an underlying String instance.

This code prints out something like:


LaUnch OUr NeWEsT ROcKEt FrOm ANY InternatIOnal WATers!

Free download pdf