Instructors' Guide

Introduction Terminology Expressions Control Objects Inheritance Technology Summary


The C++ language is without doubt a large and complex language. Fortunately, an increasing number of textbooks have become available which provide an appropriate introduction to C++ and its use for the realization of abstract data types, including  [Heading] and  [Weiss93].

Among the additional keywords introduced in C++ (extending C) we have the keyword const (which may be used to define constants), the keyword inline (which may be used to define inline expanded functions, that for C have to be defined using macros), the keyword new (to dynamically create objects on the heap), the keyword delete (to destroy dynamically created objects) and, finally, the keywords private, public and protected (to indicate access restrictions for the instances of an object class). See slide cc-term.


C++ overview

Language features:

slide: C++ -- terminology (1)

The language features offered by C++ supporting object-oriented programming include constructors (which are defined for each class to create and initialize instances), destructors (which may be used to reclaim resources), virtual functions (which must be used to effect dynamic binding), multiple inheritance (to specify behavioral refinement), type conversions (which allow the user to define coercion relations between, both system-defined and user-defined, data types), and friend declarations (which may be used to grant efficient access to selected functions or classes).

The annotated reference manual (ARM) is not a book to be used to learn the language, but provides an excellent source of detailed technical explanations and the motivations underlying particular design decisions.

Some basic terminology

name -- denotes an object, a function, set of functions, enumerator, type, class member, template, a value or a label

object -- region of storage

slide: C++ -- terminology (2)

To get an idea of the full set of features offered by C++, look at the meaning of a name in C++ (as described in the ARM). See slide cc-term-2. A name can either denote an object, a function, a set of functions, an enumerator, a type (including classes, structs and unions), a class member, a template (class or function), a value or a label. A name is typically introduced by a declaration, and is used within a scope. Moreover, each name has a type which determines its use. An object in C++ is nothing but a region of storage, with a lifetime determined by its storage class (that is, whether it is created on the stack or on the heap). Meaning is given to an object by the type used to access it, which is determined during compile time. The only information needed at runtime in C++ is concerned with virtual functions (which require a virtual function dispatch table for dynamic binding).