









Use Bit Fields to Store Significant Amounts of Data Optimally
Both C and C++ enable you to store and access data directly in the tiniest possible unit: a bit. This technique is required when dealing with a huge amount of
Both C and C++ enable you to store and access data directly in the tiniest possible unit: a bit. This technique is required when dealing with a huge amount of
Dynamic binding, for example, having a virtual member(s), is one of the basic principles of OO programming. If the compiler can resolve a call to a virtual member function statically,
Once declared virtual, a member function can be overridden in any level of derivation, as long as the overriding version has the identical signature of the original declaration. This is
The C/C++ register keyword can be used as a hint to the compiler that the declared variable is to be accessed very often during program execution, and hence, should be
An object’s member functions (both virtual and non-virtual) can be called from its constructor. The invoked virtual is guaranteed to be the one defined in the current object (or higher,
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
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
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
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