devxlogo

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);}};

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

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,

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

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