Tip Bank

DevX

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

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

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

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

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

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