devxlogo

Tip Bank

Initializing const static Data Members

The C++ Standard now allows initialization of const static data members of an integral type inside their class. #include class Buff{private: static const int MAX = 512; //definition static const

A Simple Way to Detect Client Browser Type

There are so many tools and techniques to detect the client’s browser type. However, if you want a quick two-minute solution or you just want something simple, use this code

Understanding the One Definition Rule

The One Definition Rule (ODR) says that an inline function has to be identically defined in every translation unit in which it is used. Two definitions contained in different translation

Regular Expressions in JavaScript 1.2

One of the most powerful new features of JavaScript 1.2 is a set of objects and methods to provide regular expression functionality. Perl programmers have relied on regular expressions for

Propagate User Exceptions

In Java, you can propagate checked exceptions up a class hierarchy in two ways. First, you can declare the exception in the “throws” clause of the enclosing method. Second, you

Avoid Improper Inheritance

Using public inheritance with two classes that do not fully comply with the is-a relation (although they are related to one another) is a common design mistake. For example, deriving