July 23, 1998

Forward Declarations

There are circumstances in which classes refer to one another: //file: bank.hclass Report{public:void Output(const Account& account); // compile time error; class Account is not declared yet};class Account {public:void Show() {Report::Output(*this);}}; However, an attempt to compile this header file will cause compile time errors, since the compiler does not recognize the

Unnamed Function Arguments

When an argument of a function is not used anymore in the function body (in an upgrade, for example), it needn’t be removed from the function’s argument list. It can rather become an unnamed argument. The following WriteData function used to support data streaming into various I/O devices, including 5.25″

Beware of Aliasing

Whenever your class contains pointers, references, or handles, you need to define a copy constructor and assignment operator. Otherwise, the compiler-generated copy constructor and assignment operator will result in aliasing, that is to say, the same resource will be used simultaneously by more than one object and will also be

Internationalized Strings

If you’ve been using the standard string class and you have to internationalize your software, you don’t have to give up the significant advantages class string offers: you can simply use the corresponding standard wstring class, which supports a wide characters string, yet with the same functionality of string. In

Static Variables

Static variables (not to be confused with static class members) have the qualities of both global and local variables: they are initialized by default to binary zeroes (unless explicitly initialized with a different value); they are created before program’s outset and destroyed after program’s termination. But like local variables, they