Tip Bank

DevX - Software Development Resource

Using Inner Interfaces

Inner classes are frequently used to reduce project clutter and to reduce external exposure of classes with localized usefulness. Inner interfaces are defined in a similar fashion and while they

DevX - Software Development Resource

Returning Keywords From a Map

A Hashmap is often used to store Keyword-Value pairs. The keywords are strings, so it is convenient to return a list of the keywords as an array of Strings. Fortunately,

DevX - Software Development Resource

Slicing in C++

Here is an example: class Shape {public: Shape() { }; virtual void draw() {};};class Circle : public Shape {private: int m_iRadius;public: Circle(int iRadius){ m_iRadius = iRadius; } virtual void draw()

DevX - Software Development Resource

Defining Static Data Members

Static data members must be explicitly defined exclusively in one source file. Here’s an example of a header file, such as MyClass.h: class MyClass { public: static int x; //

DevX - Software Development Resource

Using the ++ Operator

The ++ operator can be used in prefix and postfix. When it is used as a preifx , its value is evaluated first, then the statement is executed. For example:

DevX - Software Development Resource

Do Not Use Global Variables With Recursion

Global variables should never be used with recursion. It leads to stack overflow and program crash. Recursion works well only if it is in a self contained unit, using local