January 9, 1999

Obtaining a Reference to an Object

In Java, you can obtain a reference to an object in three ways. First, you can obtain it from the new operation. The new operation instantiates an object of a particular class, and returns a reference to it. This reference is a handle to the location where the object resides

Comparing Strings Efficiently

The standard string class offers three versions of the overloaded == operator: bool operator == (const string& left, const string right); bool operator == (const char* left, const string right); bool operator == (const string& left, const char* right); This proliferation may seem redundant, since string has a constructor that

Designing Legacy Code Wrapper Classes

In many systems, legacy C code is combined with newer C++ code. A common (yet wrong) practice is to wrap the C functions in a single C++ class and create a single instance thereof, which provides as its interface a series of operations mapped directly to the legacy functions. However,

Phases of Construction

The construction of an object consists of several phases, including constructing its base and embedded objects, assigning a this pointer, creating the virtual table, and invoking the constructor’s body. The construction of an object declared as const and/or volatile has an additional phase that turns an object into a const/volatile

Reduce Filtering Frustration

This code works wonders to reduce flicker and lessen your frustration. Place a timer on the form (tmr_Timer) and set the Interval to 1000. Set Enabled to False, then place this code in the txt_Filter_Change event: Private Sub txtFilter_Change() Timer1.Enabled = False Timer1.Enabled = TrueEnd Sub In the Timer event,

Set Default Font for New Controls

When you place controls on a form, the Font properties of all the controls default to a sans serif font rather than a default font that you specify. To avoid this annoyance, set the Font property for the form to the value you’d like the controls to use before placing