- One way to determine object's class
- Give base class an attribute; shapeType in class Shape
- Use switch to call proper print function
- Many problems
- May forget to test for case in switch
- If add/remove a class, must update switch structures;
Time consuming and error prone
- Better to use polymorphism
- Less branching logic, simpler programs, less debugging
2004-07-29