Monday, April 20, 2009

The TObject Branch

All VCL objects descend from TObject, an abstract class whose methods define fundamental behavior like construction, destruction, and message handling. Much of the powerful capability of VCL objects are established by the methods that TObject introduces. TObject encapsulates the fundamental behavior common to all objects in the VCL, by introducing methods that provide:

The ability to respond when objects are created or destroyed.
Class type and instance information on an object, and runtime type information (RTTI) about its published properties.
Support for message-handling.

TObject is the immediate ancestor of many simple classes. Classes that are contained within this branch have one common, important characteristic, they are transitory. What this means, is that these classes do not have a method to save the state that they are in prior to destruction, they are not persistent.
One of the main groups of classes in this branch is the Exception class. This class provides a large set of built-in exception classes for automatically handling divide-by-zero errors, file I/O errors, invalid typecasts, and many other exception conditions.

Another type of group in the TObject branch are classes that encapsulate data structures, such as:

TBits, a class that stores an “array” of Boolean values
TList, a linked list class
TStack, a class that maintains a last-in first-out array of pointers
TQueue, a class that maintains a first-in first-out array of pointers

You can also find wrappers for external objects like TPrinter, which encapsulates the Windows printer interface, and TRegistry, a low-level wrapper for the system registry and functions that operate on the registry.
TStream is good example of another type of class in this branch. TStream is the base class type for stream objects that can read from or write to various kinds of storage media, such as disk files, dynamic memory, and so on.
So you can see, this branch includes many different types of classes that are very useful to you as a developer.

No comments:

Post a Comment