Está en la página 1de 1

Lecture 1 : Data Types

The Basic Data Types are provided by most high-level programming languages:

Full name: integer, real, character, boolean

C++ name: int, float, char, bool

Basic Data Types can be grouped together into Structured Data Types:

arrays, strings, records

In C++ a record is called a struct – for example:

struct BookRecord {
char title[40];
float callnumber;
};
BookRecord book;
book.callnumber = 5.265;

Abstract Data Types (ADT)

The specification of a data structure separate from the implementation.

For example:

A book record consists of:


title (max 40 characters)
call number (real number)

Advantage of ADTs

1. Reduce details – allows focus to be on the “main picture”


2. Different implementations can be used – e.g. array or linked-list
3. Underlying implementation can be changed or upgraded
4. It is convenient to implement an ADT as a class

In 159.201 most ADTs will be implemented based on an array or a linked-list.

También podría gustarte