Classes: an abstract data type facility for the C language

  • Authors:
  • Bjarne Stroustrup

  • Affiliations:
  • Bell Laboratories, Murray Hill, New Jersey

  • Venue:
  • ACM SIGPLAN Notices
  • Year:
  • 1982

Quantified Score

Hi-index 0.00

Visualization

Abstract

Language constructs for definition and use of abstract data types ease the design and maintenance of large programs. This paper describes the C class concept, an extension to the C language providing such constructs. A class is defined using standard C data types and functions, and it can itself be used as a building block for new classes. A class provides a way of restricting access to a data structure to a specific set of functions associated with it, without incurring significant overheads at compile time or at run time.The C class concept is introduced by small examples of its use, and familiarity with the C language [2] is assumed. Appendix A is a complete small C program using classes.Classes have been in use for more than a year on a dozen PDP11 and VAX UNIX systems [1], and they are currently used for a diverse set of projects on more than 30 systems. Classes are currently implemented by an intermediate pass of the cc compiler, called the class pre-processor, which is invoked when the directive #class is found in a C source file. The class pre-processor is easily ported to a system with a version of the portable C compiler. A Motorola68000 version is in use.