In recent years, Borland has provided Turbo C++ and Borland C++ users with a solid set of class libraries to use as a foundation for building custom applications. This includes the TurboVision and ObjectWindows class libraries (user-interface classes for DOS and Windows), and the Container class library (general purpose array, list, and unordered collection classes). In the version of the Container class library that shipped with Borland C++ 3.1, Borland stabilized its support for the Object-based container classes.
In the Smalltalk language, every class has the Object class as a base class. No matter how far down the inheritance tree you look, all classes must derive from the Object class at the top. This is known as a single-root hierarchy.
In C++, you don't have to derive your classes from an arbitrary base class like the Smalltalk Object class. However, before C++ supported class and function templates (parameterized types), using such a single-root hierarchy made designing general-purpose array or container classes much easier. This was the case because you could define basic operations for objects you'd store in a container (for example, a sorting value). Since Borland developed the first version of its Container class library before templates were available in C++, the standard Container class library classes can only hold objects of classes that derive from Borland's Object class.
Unfortunately, this means you'll have to derive your data
classes from the Object class if you want to hold these
items in a container from this class library. To learn how to
derive your classes from the Object class, see the class
reference for the Object class in chapter 6 of the Borland
C++ Programmer's Guide.
Copyright (c) 1996 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of Ziff-Davis Publishing Company.