previous up next print clean
Next: DEFINITIONS Up: Introduction Previous: Introduction

The C++ language

To ameliorate the problem of many of the readers of this document knowing little of C and C++, we introduce concepts of C and C++ as slowly as we can. A recommended learning pathway is to begin from any of the many dozens of C tutorial books concentrating on learning particularly well the ideas of pointer, structure, and typedef. Then switch to the book Sessions (1992) which concerns itself mainly with the ``class'' and ``inheritance'' concepts, avoiding the full minutia of the C++ language.

Going beyond Fortran, the first concept needed is that of a structure. For example, in Fortran, if a single symbol could represent the idea of (n,(x(i), i=1,n) then that symbol would denote something like a structure. Another structure might be (n1,n2, ((x(i1), i1=1,n1), i2=1,n2). A numerical analyst thinking about solving the multivariate regression $\bold y \approx \bold A \bold x$might need to allocate several instances of the structure representing $\bold x$.Clearly, the solver program written by the analyst should work for all possible structures. In Fortran the application programmer ends out allocating the temporary arrays needed by the numerical analyst, leading to long, error prone calling sequences. In Fortran the work of the applications programmer and the numerical analyst are typically brought together by subroutines. C also uses subroutine libraries, and additionally it makes heavy use of ``include files'' that define structures thus serving to better isolate science from numerical analysis. C++ extends the structure concept to a ``class,'' which is a structure containing subroutine pointers and has elaborate provisions for sharing and hiding data, for defaulting and overriding functions. C++ also uses include files to implement a new method of merging the work of the applications programmer to the numerical analyst called ``inheritance'' or ``derivation'' whose explanation is beyond the scope of this brief summary but which should become clearer as you progress through this document.


previous up next print clean
Next: DEFINITIONS Up: Introduction Previous: Introduction
Stanford Exploration Project
11/17/1997