
Checking for Null After New (2)
Normally, you should not check for null after creating an object. MyObject o = new MyObject(); This check is not required in Java because ‘new’ is not allowed to return

Normally, you should not check for null after creating an object. MyObject o = new MyObject(); This check is not required in Java because ‘new’ is not allowed to return

A rule of thumb in class design says that if a class has at least one virtual function, it should have a virtual destructor, too. This is because the presence

I have a much simpler form for the IsAlphaNum function: Public Function IsAlphaNum(ByVal sString _As String) As BooleanIf Not sString Like “*[!0-9A-Za-z]*” _Then IsAlphaNum = TrueEnd Function You can modify

Although VB has an IsNumeric function, it has no IsAlpha function. Use this routine whenever you want to determine whether a character or string of characters is alphabetic (A-Z or

This can be done by using ResultSetMetaData. For example, to get the number of columns you can use: /* get the meta-information about the result set */ResultSetMetaData metaData = rs.getMetaData();

Traditional testing for alphabetic characters

Blank finals are fields that are declared as final, but are not given an initialization value. Java allows the creation of blank finals, but, in all cases, the blank final

Sometimes you need to know the number of bits set in a word. I often see code to count the number set bits written as a loop, processing one bit

When you need to add the same member function to several classes, you can use a template class, derived from its template argument. template class T : public P {public: