Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
While polymorphism is a fundamental OOP concept, it doesn't help very much if its use and purpose are not understood. It's just one of the many basic concepts in object-oriented programming that's used to point to different implementations of objects in multiple forms. One feature you'll see in the State design pattern is that the polymorphism is pretty obvious. This will help you better understand how polymorphism can be useful in OO programs.
Looking at the State interface in Example 10-1, you can see the different methods that become core behaviors for different states. Each state is its own class. However, as you look at each class, you can see that the behaviors of the same methods take on different forms—polymorphism hard at work. Just look at each of the state classes, and there you see all of the same methods but in different forms.