Visual Basic is a prominent example. Composition can substitute for inheritance generally, but the results are far from pretty. Object models benefit from the thoughtful leveraging of both. Inheritance is clumsy and inefficient when objects transition from one type to another. Use composition when objects need to transmute from one subclass to another.
Inheritance is appropriate when one class extends another class.
In Part II, we'll take a look at abstract base classes and descendant classes, and why programming to the former is an essential aspect to object model design. Glenn E. Mitchell II is president of .Com Consulting Group, a consulting firm in Tallahassee, FL, specializing in Microsoft technology. Glenn focuses on object-oriented software architecture. He holds a Ph.D. from the University of Iowa. Mr Mitchell explains the pitfalls of inheritance overuse, and the advantages of composition, which is too often underused.