void print( Printer* pr ) { if ( pr->type == 'L' ) { // ... } else if ( pr->type == 'I' ) { // ... } else if ( pr->type == 'F' ) { // ... } }
Print function becomes very complex over time.
Multiple flag variables introduced to control the if-else logic.
Only experienced veteran programmers understand how it works.
New programmers become frustrated when assigned to make changes in print( )
. . .
Solutions?
C++ OO design.