A simple example of the Open/Closed Principle

added by webpoet
7/13/2010 12:01:16 AM

2 Kicks, 127 Views

The Open/Closed Principle says that we should strive to write code that doesn’t have to be changed every time the requirements change. When using Java, C# or other statically typed languages the solution often involves inheritance and polymorphism, which is what this simple example illustrates.