Com Sci

Page 1

ADTs in C++

Douglas C. Schmidt

Topics Describing Objects Using ADTs

C++ Support for Abstract Data Types

Built-in vs. User-defined ADTs C++ Support

Douglas C. Schmidt Professor d.schmidt@vanderbilt.edu www.cs.wustl.edu/ schmidt/

Department of EECS Vanderbilt University (615) 343-8197

Vanderbilt University

ADTs in C++

Douglas C. Schmidt

1

ADTs in C++

Douglas C. Schmidt

Built-in ADTs

Describing Objects Using ADTs boolean

An ADT is a collection of data and associated operations for manipulating that data

– Values: true and false – Operations: and, or, not, nand, etc.

ADTs support abstraction, encapsulation, and information hiding

integer

They provide equal attention to data and operations Common examples of ADTs:

– Values: Whole numbers between MIN and MAX values – Operations: add, subtract, multiply, divide, etc.

– Built-in types: boolean, integer, real, array – User-defined types: stack, queue, tree, list

arrays

– Values: Homogeneous elements, i.e., array of X. . . – Operations: initialize, store, retrieve, copy, etc.

Vanderbilt University

2

Vanderbilt University

3


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.