OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Constructing and Destroying TXBase

TXBase provides two public constructors:

TXBase(const string& msg);
TXBase(const TXBase& src);

The first constructor initializes the classlib.hlpxmsg" base class with the value of the string parameter, calling the xmsg constructor that takes a string parameter. The second creates a new object that is a copy of the TXBase object passed in as a parameter.

Both constructors increment the TXBase data member TXBase::InstanceCount, a static int (causing there to be only a single instance of the member no matter how many actual TXBase or TXBase-derived objects exist in the application). The TXBase destructor decrements InstanceCount. The destructor is declared virtual to allow easy overriding of the destructor.

Because each new TXBase or TXBase-derived object increments InstanceCount, and each deleted TXBase or TXBase-derived object decrements InstanceCount, the value of InstanceCount reflects the total number of TXBase and TXBase-derived objects existing in the application at the time. To access InstanceCount from outside a TXBase or TXBase-derived class, qualify the name InstanceCount with a TXBase:: scope qualifier.