April 17, 1998

Static member function

A static member function in a class can access only other static members of a class or variables which are not members of its class. It can be invoked even

Retrieving actual object type in run-time

C++ supports Run-time Type Identification (RTTI), which enables detection of actual object type during program execution using the built-in typeid() operator. Here is an example: //file: classes.hclass base{ base(); virtual

Global objects construction and destruction

In object-oriented programming (OOP), global objects are considered harmful. Particularly in C++, there’s even more reason to think twice before using them: a global object construction occurs before a program’s

When is a mem-initializer required?

A const member or a reference member cannot be initialized within an object’s constructor. Instead, they must be initialized in the constructor’s member-initializer list. Conceptually, mem-initialization takes place before the