Programming in C++: Rules and Recommendations

Copyright (C) 1990-1992 by

Ellemtel Telecommunication Systems Laboratories

For copyright information, see the home page.

2 Terminology

1 identifier
An identifier is a name which is used to refer to a variable, constant, function or type in C++. When necessary, an identifier may have an internal structure which consists of a prefix, a name, and a suffix (in that order).

2 class
A class is a user-defined data type which consists of data elements and functions which operate on that data. In C++, this may be declared as a class; it may also be declared as a struct or a union. Data defined in a class is called member data and functions defined in a class are called member functions.

3 abstract data type
A class/struct/union is said to be an abstract data type if it does not have any public or protected member data.

4 structure
A structure is a user-defined type for which only public data is specified.

5 public members
Public members of a class are member data and member functions which are everywhere accessible by specifying an instance of the class and the name.

6 protected members
Protected members of a class are member data and member functions which are accessible by specifying the name within member functions of derived classes.

7 class template
A class template defines a family of classes. A new class may be created from a class template by providing values for a number of arguments. These values may be names of types or constant expressions.

8 function template
A function template defines a family of functions. A new function may be created from a function template by providing values for a number of arguments. These values may be names of types or constant expressions.

9 enumeration type
An enumeration type is an explicitly declared set of symbolic integral constants. In C++ it is declared as an enum.

10 typedef
A typedef is another name for a data type, specified in C++ using a typedef declaration.

11 reference
A reference is another name for a given variable. In C++, the `address of' (&) operator is used immediately after the data type to indicate that the declared variable, constant, or function argument is a reference.

12 macro
A macro is a name for a text string which is defined in a #define statement. When this name appears in source code, the compiler replaces it with the defined text string.

13 constructor
A constructor is a function which initializes an object.

14 copy constructor
A copy constructor is a constructor in which the first argument is a reference to an object that has the same type as the object to be initialized.

15 default constructor
A default constructor is a constructor which needs no arguments.

16 overloaded function name
An overloaded function name is a name which is used for two or more functions or member functions having different types. [fn: The type of a function is given by its return type and the type of its arguments.]

17 overridden member function
An overridden member function is a member function in a base class which is re-defined in a derived class. Such a member function is declared virtual.

18 pre-defined data type
A pre-defined data type is a type which is defined in the language itself, such as int.

19 user-defined data type
A user-defined data type is a type which is defined by a programmer in a class, struct, union, enum, or typedef definition or as an instantiation of a class template.

20 pure virtual function
A pure virtual function is a member function for which no definition is provided. Pure virtual functions are specified in abstract base classes and must be defined (overridden) in derived classes.

21 accessor
An accessor is a function which returns the value of a data member.

22 forwarding function
A forwarding function is a function which does nothing more than call another function.

23 constant member function
A constant member function is a function which may not modify data members.

24 exception
An exception is a run-time program anomaly that is detected in a function or member function. Exception handling provides for the uniform management of exceptions. When an exception is detected, it is thrown (using a throw expression) to the exception handler.

25 catch clause
A catch clause is code that is executed when an exception of a given type is raised. The definition of an exception handler begins with the keyword catch.

26 abstract base class
An abstract base class is a class from which no objects may be created; it is only used as a base class for the derivation of other classes. A class is abstract if it includes at least one member function that is declared as pure virtual.

27 iterator
An iterator is an object which, when invoked, returns the next object from a collection of objects.

28 scope
The scope of a name refers to the context in which it is visible. [fn: Context, here, means the functions or blocks in which a given name can be used.]

29 compilation unit
A compilation unit is the source code (after preprocessing) that is submitted to a compiler for compilation (including syntax checking).

Next section: 3 General Recommendations

Robert M. Adams' Home Page