Tip Bank

DevX - Software Development Resource

Preventing Derivation

In general, disabling inheritance is a dubious idea. Yet under some circumstances it may be useful. To do this, declare the class in question (called A in our example) as

DevX - Software Development Resource

Use C-Style Arrays as Containers

C-style arrays can be passed as containers to STL algorithms. The pointers to array elements can be used as iterators.Example: #include #include int main(){ int array[] = { 1, 3,

DevX - Software Development Resource

Inhibit Derivation from a C++ Class

If no other classes can derive from a class, then you know that all the pointers to that class point to objects of a uniform size. This can simplify memory

DevX - Software Development Resource

Switch Statements in Object Oriented Design

There is nothing intrinsically evil about ‘switch’ statements. However, they do sometimes result from improper Object Oriented design. There are twodesign principles to keep in mind.1. Open/Closed Principle: this states