Wednesday, August 16, 2006


Polymorphism is the ability of an object to assume multiple forms. The example below assumes a class hierarchy with Appender as the superclass. For now it is sufficient to know that the Appender class has a responsibility to append a log statement to a certain destination. This class has three subclasses, ConsoleAppender, FileAppender, and DatabaseAppender, each of which implement the 'append' of the superclass to direct the log statement to the console, file, and database respectively. The audio explains polymorphism with this simple example.

[Time: 3 mins 40 secs]

Watch a simple animation of how Polymorphism works.

Note: This post was originally posted on my blog at

No comments: