{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

8new_subtyp_enum

# 8new_subtyp_enum - Introduction to Computers and...

This preview shows pages 1–5. Sign up to view the full content.

Introduction to Computers and Programming Lecture 8 Types values similarity of values and primitive operations Elementary types Composite Types Prof. I. K. Lundqvist Reading: FK pp. 115-151 Sept 17 2003 • Type – A set of – A set of primitive operations • Grouped into classes based on the

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Elementary Types : Values are logically indivisible Composite Types : Values composed from components Type Classification Elementary Types Scalar Types Access Types Discrete Types Real Types Scalar Types relational operators are defined position number Scalar Types Discrete Types Real Types Integer Types Enumeration Types Fixed Point Floating Point • Ordered • Each value of a discrete type has a
Attributes of Scalar Types range of S. The value of this attribute is of the type of S. range of S Operations on Scalar Types the value in the type string on the scalar type – S’Succ (Integer) : returns (Integer + 1) S’First denotes the lower bound of the S’Last denotes the upper bound of the S’Range is equivalent to the range S’First .. S’Last S’Min returns lower of two elements S’Max returns higher of two elements S’Value accepts a string and returns S’Image converts the value into a S’Pred and S’Succ – behavior depends S’Pred (Integer) : returns (Integer -1)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Subtypes • A subtype type.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}