devxlogo

November 20, 1998

How Do I Christen This Class?

Good design goes hand in hand with the nomenclature it uses for exchanging that design between developers. A key feature to writing good code consists of good naming conventions and

Checking Whether a Stack Is Empty

It is an error to call the member function pop() on an empty stack. If you are not sure whether a stack contains any elements, you can use the member

Always Initialize Pointers

An uninitialized pointer has an indeterminate value. It’s almost impossible to test subsequently whether such a pointer is valid, especially if it is passed as an argument to a function,

Simplify Creating and Adding Menu Items

When creating menu items and adding them to a menu, you can shorten your code by combining two steps into one. Instead of creating the menu item and adding it

Data Pointers vs. Function Pointers

C and C++ make a clear-cut distinction between two types of pointers: data pointers and function pointers. A function pointer embodies several constituents such as the list of arguments, a

When to Use a Pure Virtual Member Function

A pure virtual function is merely an interface and can be thought of as a way to enforce policy. A pure virtual function should be used when subclasses implement the