GNA C++ Tutorial Glossary
Last changed: August 1
Here is a little guide how to use the glossary,
and here is the PostScript version.
Note that some of the top-level links go to the
STING glossary.
The whole course material is
keyword searchable.
- Abstract class
- Class with only pure virtual functions.
- Access type
- Keywords
private, protected, and
public. See encapsulation.
- Array
- An aggregate of elements of the same type.
- Attributes
- Type and Storage mode of a variable.
-
auto
[matic]
- Variable storage class with keyword "
auto
"-
default for declarations within function bodies.
If a compound statement contains variable declarations, then these variables
can be acted on within the scope of the enclosing
compound statement. See also: "extern
",
"static
", and
""register
".
- C++
- High-level programming language which contains the
C language
as a subset supporting object oriented programming.
- Call by reference
- In C++, you can declare a function
parameter to be a pointer, e.g.
"
void order(int*,int*);
", then use the dereferenced pointer
in the function body, and pass an address as an argument when the
function is called: "order(int&p, int&q);
- to change
the values of "p
" and "q
" in the calling
environment.
- Call by value
- Argument-passing mechanism strictly adhered to in C: variables are
passed as arguments to a function copying their values to corresponding
function parameters without changing them in the calling environment.
See also call-by-reference.
- Cast
- Explicit conversion (or coercion)
of a type in contrast to automatic conversions
which are implicit and can occur across assignments and in mixed expressions.
E.g., if i is an
int
, then '(double)i
'
casts the value of i so that the expression has type
double
. The cast operator '(<type>)
' is a
unary operator having the same precedence as other unaries.
-
cerr
- Function which tells the system to output data to the standard-error
stream (
stderr
). See also: cin
,
cout
.
-
cin
- Function which tells the system to input data in the standard-input
stream (
stdin
), used with the
extraction operator. See also:
cerr
, cout
.
class
- User-defined data type. The prototype for an object
in an object oriented language; analogous to a derived type
in a procedural language.
- Client
- Alias for pure application program.
- C++ Compilers
- Separate list.
- Concurrency
- The property that distinguishes active objects from
passive ones.
Characteristic of the Object Design Model.
-
const
- Keyword defining a constant. Its value cannot be
accidentally or purposefully changed. A constant should be initialized upon
declaration to have a useful value. (The compiler,
however, will not issue an error message if you do not.) See also
volatile.
- Constructor (ctor)
- Member function with the same name as the
class.
It constructs objects of the class type. Invoked when
associated type used in a definition.
- Container Class
- A class whose instances are collections of
other objects.
Each object of a container class is a container. Examples are
stacks, lists, arrays, and sets.
-
cout
- Function which tells the system to output data to the standard-output
stream (
stdout
), used with the
insertion operator. See also:
cerr
, cin
.
- Data Abstraction
- Programming paradigm including modularity.
The essential characteristic of an object
that distinguish it from all other kinds of objects and thus provide
crisply defined conceptual boundaries, relative to the perspective of
the viewer.
Characteristic of the Object Design Model.
- Definition
- Allocation of storage for an object.
- Declaration
- Assertion or announcement that an object exists.
-
delete
- The keyword "delete" destroys an
object created by
new
, in
effect returning its allocated storage to free store for reuse. It is used
either as "delete " or as "delete [] ". The
expression is typically a pointer variable. The 2nd form
is used when store allocated as an array type is returned:
"[]" indicates that a DTOR should be called for
each array element. "delete" returns a value of type
void
.
- Derivation
- Mechanism to establish an inheritance
principle.
- Destructor (dtor)
- Member function whose name is the
class name preceded by a "
~
" character.
It destroys values of the class type.
- Dynamic allocation
- During the design of C++, it was felt that dynamic allocation operation was to
be part of the language, rather than a library add-on like
malloc(), because of its massive use. See
new
and delete
.
- Encapsulation
- Support for a "data hiding"
paradigm: hiding the details of an object that
do not contribute to its (abstract) essential characteristics.
Characteristic of the Object Design Model.
-
enum
- Keyword declaring a distinct integer type with a
set of name integer constants called enumerators. Declaration format:
enum <tag-name> { <list of enumerators> }. The
enumerators can be defined and initialized to arbitrary integer constants.
They can also be declared anonymously, without a tag-name.
If not initialized, their values default to 0, 1, 2, 3...etc.
-
extern
- a variable global to all functions declared after it (with permanent
storage);
- Extraction operator
- Or "get from" operator,
>>
. Used with the
cin
input function. Tells the system to input
data trying to match its type according to the definition.
See also: cout, cerr
.
- Field
- Bundle of tiny variables in a
struct
.
-
friend
- A class which has unlimited access to
private members to the class who declares it as
friend
. Disabled by derivation.
Rule: "My father's friends are not my friends".
-
Function overloading
- In C++, the same symbol name can be used for two or more functions,
as long as these multiple functions differ in at least one parameter.
-
g++(1)
- The free GNU C++ compiler. On top of
gcc(1)
, the GNU
C compiler.
-
gdb(1)
- The free GNU C++ and C debugger.
- Hierarchy
- A ranking or ordering of abstractions.
Characteristic of the Object Design Model.
- Inheritance
- Relator between classes. An
OOP
paradigm which allows members of one class to be used as if they were
members of a second class. Supported in C++
by a derivation mechanism:
If class B is derived from class A, B
is a "kid", "child" or subclass of the "parent", super- or
base class A. A base class without parents is called
the "root" class of the inheritance tree. See also
encapsulation.
inline
- Keyword to preface a function
declaration when the programmer intends the code
replacing the function call to be inline. The compiler parses this function,
providing semantics equivalent to a non-inline version.
Compiler limits prevent complicated functions from being <inlined.
- Insertion operator
- Or "put to" operator,
<<
, used with the
cout
output function. Tells the system to
output data trying to match its type according to the definition.
See also: cin
, cerr
.
- Keywords
- Some C++ keywords which are not defined in the C language:
asm catch class delete friend
inline new operator private protected
public template throw try virtual
- Lvalue
- "Location" value, the memory address of an rvalue.
- Map
- (Aka associative array, dictionary) a
container class which keeps pairs of values.
Given the one value, called the key
one can access the other, called the value. Like an
array where the index need not be an integer.
- Member access operator "
.
"
- A postfix expression followed by a dot ("
.
") followed
by a name is a postfix expression. The first must be a
class object, and the name must
name a member of that class. The result is the named member of the object,
and it is an lvalue if the member is an lvalue.
- Member access operator "
->
"
-
A postfix expression followed by an arrow ("
->
") followed by
a name is a postfix expression. The first must be a pointer
to a class object and the name must
name a member of that class. The result is a named member of the object to
which the pointer points and it is an lvalue if the member is an
lvalue. Thus e.g. "class->member
" is the
same as "(*class).member
".
- Member function
- Routine defined within a class, which operate on an
object's data, and is part of its behavior. Activated by
function calls, also referred to as messages.
- Message
- Call to a member function, which activates it.
- Method
- An alternate term for member function.
- Modularity
- The property of a system that has been decomposed into a set of cohesive
and loosely coupled modules.
Characteristic of the Object Design Model.
-
new
- The keyword "new" is an operator for carrying out
dynamic allocation. "new" requires one
modifier and allocates a variable of the specified type
on the heap, returning a pointer to
that variable. If that pointer is reassigned, the
reference to the variable that the pointer was
previously pointing to is lost, and it can never be used or deallocated.
See
delete
.
- Non-OOP extensions of C++
- In general, C++ provides more language features and fewer
restrictions than ANSI-C, so most constructs in ANSI-C are legal
within C++ with their meanings unchanged. There are
exceptions, though.
- Object
- A region of storage with associated semantics. More specifically, an
object consists of data structures encapsulated with a set of routines, often
called methods which operate on the data.
- Overloading
- Assigning different meaning to the same name. For
functions and operators. The overloaded meaning is selected by
matching the signature (argument list) of the function call to the
function declaration.
-
Operator overloading
- Operator overloading is a mechanism that lets you add new data types
to those that C++ operators are designed to handle. The
overloading of operators is only available
for classes and not for the predefined simple types.
- Object Model
- The object oriented design model has several aspects:
abstraction,
encapsulation,
modularity,
hierarchy,
typing,
concurrency, and
persistence.
- Object Oriented Programming (OOP)
- OOP = Type-extensibility + Polymorphism.
Programming paradigm beyond and including
data abstraction facilities.
Basic support needed consists of a class mechanism
with inheritance and a mechanism that allows
calls of member functions to depend on the
actual type of an object (in cases where the actual type
is unknown at compile time). See also object model.
- Persistence
- The ability of an object to exist beyond the time
(and/or location) of the context that created it. Includes aspects of:
persistent storage and data member retrieval, resolving
pointers and/or references
across address spaces, consistent class descriptions.
Characteristic of the Object Design Model.
- Pointer
- Reference values that are addresses of
objects in memory.
Defined with the "dereferencing" operator "
*
", initialized
with an lvalue
of a data object with the "address-of" operator "&
": If
v is declared a variable then
&
v is v's memory address.
If p is declared a pointer, then *
p
is the value of the variable that p points to.
- Polymorphism
- Collective name for the capabilities of C++ for
overloading,
virtuality and definition of parametrized types
(
template
). Can include
serious
run-time overhead.
-
private
- Members which can only be accessed by
classes declared as friend.
-
public
- Members which are accessible throughout
the program.
- Procedural programming
- Simplest programming paradigm, useful to bring order in the
maze of algorithms available to solve a particular problem numerically.
Supported by all modern programming languages by facilities for passing
arguments to and returning values from functions. Elementary condition
of programming rather than a method of choice.
-
protected
- Members which are only accessible by the
immediate children of a class.
- Prototype
- Declaration of a function before it is defined.
- Reference
- Declaration which allows for the same object
to be given an alternate name, can be used for
call-by-reference arguments. When declaring
"
int n; int& nn=n;
", "nn
" is an alias for
"n
". Declarations of references that are definitions must be
initialized.
See also pointers.
-
register
-
A keyword used to advise the compiler to put few (often
accessed) variables in high-speed registers.
- Rvalue
- "Read-only" value, the data value of a variable. See also
lvalue.
- Scope
- Local, to a block (function body), or to a file through
external or global names.
See also encapsulation.
- Scope resolution operator "
::
"
- The C++ operator with the highest precedence, coming in two forms:
As a unary operator, like "
::var
", to refer to external
scope of "var
", to uncover or access a name that has been hidden
by local or class scope. As a binary
operator, as in "foo_bar::var
" to refer to class scope, to
disambiguate names that are resused within classes.
- Simple (built-in) types
- The simple native types in C++ are:
"
double
", "int
" and "char
". They
can be modified by the keywords: "short
",
"long
", "signed
" and "unsigned
" to yield
further simple types (ordered from smallest to biggest):
char signed char unsigned char
short int long
unsigned short unsigned unsigned double
float double long double
To determine the number of bytes a particular object or
type requires, use the "sizeof()
" function. See also article on
C++ Built-in Types.
-
static
- Variable storage mode with two distinct uses: first, to allow a local
variable to retain its previous value when the block is reentered (in
contrast to "
auto
"[matic] variables which loose their value
upon block exit and must be reinitialized). The keyword can also be used
in connection with external declarations providing a privacy mechanism
important for program modularity.
See also "auto
[matic]",
"register
" and
"extern
".
- Storage modes of a variable
- They are:
auto
(default), referring to (de)allocation at
block borders; register
to advise the compiler to put few (often
accessed) variables in high-speed registers; extern
, making a
variable global to all functions declared after (with permanent storage);
static
for value-retention, zeroing and declaration of external
languages. See: "auto
[matic]",
"register
",
"extern
" and
"static
".
- Stream library
- External standard library for input/output. Information needed by your
program to use this library resides in the
iostream.h
header
file. Also the library stdio.h
used in C is available
to C++ programmers (for the "printf()
" function e.g.).
-
struct
- An aggregate of elements of arbitrary types. A
class
with
public
members only.
-
template
- Parametrized user-defined types. A clever macro
obeying scope, naming conventions and type rules of C++. A specification
of how to make a family of related (container)
classes. Used to specify and name families of types and functions.
-
this
- The this keyword is a pointer
that's available to all member functions in a class. Thie this
pointer addresses the instance of the class that called the function.
The this pointer is also available in constructors and destructors.
The this pointer is passed as a hidden parameter to every member
function in a class. The pointer has the same type as a declared pointer
to the class.
-
typedef
- Specifier to declare identifiers that are later used
for naming fundamental or derived types. Becomes a synonym for
another type.
- Typing
- The enforcement of the class
of an object,
such that objects of different classes may be interchanged only in well-defined
ways. Characteristic of the Object Design Model.
-
union
- Derived type whose syntax is the same as for structures, except
that the keyword
union
replaces struct
. The
member declarations share storage and their values are overlaid. Therefore
a union
allows its values to be interpreted as a set of types
that correspond to the member declarations. A union
is
free if it does not have a name.
-
volatile
- Keyword implying that an agent external to the
program can change the variable's value, too. A variable of type
volatile const
cannot be changed by you, but may be the system,
e.g. through an external time signal.
References
The following references were used to compile the glossary information.
- B. Stroustrup, The C++ Programming Language", 2nd ed.
Addison-Wesley 1992.
- I. Pohl, Object-Oriented Programming Using C++,
Benjamin-Cummings 1993.
- S.B. Lippman, C++ Primer, 2nd ed. Addison-Wesley 1991
- C++ Report, SIGS Publication Group, ed. by S.B. Lippman.
- C++ FAQ,
by Marshall Cline for
comp.lang.c++
- STING glossary, by Mike Sendall (CERN) for the Software Technology Interest Group.
ms, with
Benedetto Femia and
Frank Chen
GNA C++ Course Index