Defined Terms
anonymous union Unnamed union that is not used to define an object. Members of an anonymous union become members of the surrounding scope. These unions may not have member functions and may not have private or protected members.
bit-field Class member with a integral type that specifies the number of bits to allocate to the member. Bit-fields defined in consecutive order in the class are, if possible, compacted into a common integral value.
discriminant Programming technique that uses an object to determine which actual type is held in a union at any given time.
dynamic_cast Operator that performs a checked cast from a base type to a derived type. When the base type has at least one virtual function, the operator checks the dynamic type of the object to which the reference or pointer is bound. If the object type is the same as the type of the cast (or a type derived from that type), then the cast is done. Otherwise, a zero pointer is returned for a pointer cast, or an exception is thrown for a cast to a reference type.
enumeration Type that groups a set of named integral constants.
enumerator Member of an enumeration. Enumerators are
const
and may be used where integral constant expressions are required.free Low-level memory deallocation function defined in
cstdlib
.free
may be used only to free memory allocated bymalloc
.linkage directive Mechanism used to allow functions written in a different language to be called from a C++ program. All compilers must support calling C and C++ functions. It is compiler dependent whether any other languages are supported.
local class Class defined inside a function. A local class is visible only inside the function in which it is defined. All members of the class must be defined inside the class body. There can be no
static
members of a local class. Local class members may not access the nonstatic
variables defined in the enclosing function. They may use type names,static
variables, or enumerators defined in the enclosing function.malloc Low-level memory allocation function defined in
cstdlib
. Memory allocated bymalloc
must be freed byfree
.mem_fn Library class template that generates a callable object from a given pointer to member function.
nested class Class defined inside another class. A nested class is defined inside its enclosing scope: Nested-class names must be unique within the class scope in which they are defined but can be reused in scopes outside the enclosing class. Access to the nested class outside the enclosing class requires use of the scope operator to specify the scope(s) in which the class is nested.
nested type Synonym for nested class.
nonportable Features that are inherently machine specific and may require change when a program is ported to another machine or compiler.
operator delete Library function that frees untyped, unconstructed memory allocated by
operator new
. The libraryoperator delete[]
frees memory used to hold an array that was allocated byoperator new[]
.operator new Library function that allocates untyped, unconstructed memory of a given size. The library function
operator new[]
allocates raw memory for arrays. These library functions provide a more primitive allocation mechanism than the libraryallocator
class. Modern C++ programs should use theallocator
classes rather than these library functions.placement new expression Form of
new
that constructs its object in specified memory. It does no allocation; instead, it takes an argument that specifies where the object should be constructed. It is a lower-level analog of the behavior provided by theconstruct
member of theallocator
class.pointer to member Pointer that encapsulates the class type as well as the member type to which the pointer points. The definition of a pointer to member must specify the class name as well as the type of the member(s) to which the pointer may point:
This statement defines
pmem
as a pointer that can point to members of the class namedC
that have typeT
and initializespmem
to point to the member inC
namedmember
. To use the pointer, we must supply an object or pointer to typeC
:fetches
member
from the objectclassobj
of the object pointed to byclassptr
.run-time type identification Language and library facilities that allow the dynamic type of a reference or pointer to be obtained at run time. The RTTI operators,
typeid
anddynamic_cast
, provide the dynamic type only for references or pointers to class types with virtual functions. When applied to other types, the type returned is the static type of the reference or pointer.scoped enumeration New-style enumeration in which the enumerator are not accessible directly in the surrounding scope.
typeid operator Unary operator that returns a reference to an object of the library type named
type_info
that describes the type of the given expression. When the expression is an object of a type that has virtual functions, then the dynamic type of the expression is returned; such expressions are evaluated at run time. If the type is a reference, pointer, or other type that does not define virtual functions, then the type returned is the static type of the reference, pointer, or object; such expressions are not evaluated.type_info Library type returned by the
typeid
operator. Thetype_info
class is inherently machine dependent, but must provide a small set of operations, including aname
function that returns a character string representing the type’s name.type_info
objects may not be copied, moved, or assigned.union Classlike aggregate type that may define multiple data members, only one of which can have a value at any one point. Unions may have member functions, including constructors and destructors. A union may not serve as a base class. Under the new standard, unions can have members that are class types that define their own copy-control members. Such unions obtain deleted copy control if they do not themselves define the corresponding copy-control functions.
unscoped enumeration Enumeration in which the enumerators are accessible in the surrounding scope.
volatile Type qualifier that signifies to the compiler that a variable might be changed outside the direct control of the program. It is a signal to the compiler that it may not perform certain optimizations.
T C::*pmem = &C::member;
classobj.*pmem;
classptr->*pmem;