| Prev | 06 Names | Chapter 5 sections 1 to10 | lab06 C/C++ Scoping |
| Today | ** Project Phase 1 | UML of old+Proposed changes(10 pts) | |
| Today | 07 Data Types | Chapter 6 not section 8(unions) | lab07 C/C++ Data |
| Next | 08 Expressions etc | Chapter 7 not section 8 | lab08 C/C++ Expressions |
2. Answer review questions at end of chapter 6 .
3. Hand in 3 or more answers to review questions.
Notes
Standard C++ comes with a large library (the STL) of powerful data types.
CSCI 330 (Data Structures) is an in depth study of this material.
Decimal Data Types
Decimal data is a very important data type becuase it is used to represent
money.
Accountants require precise decimal arithmetic -- to avoid fraud.
UML and Data Types
The UML has four primitive data types: Real, Integer, Boolean, String.
Enumerations in the UML (6.4.1) are written:
enum{ value1, value2, ...}
in the OCL and stereotyped as
<<enumeration>>in UML2.0. Their values are written
#Value1, #Value2, ...
In place of array(6.5) we have multiplicities(0..*, 4..5, ...) Put them on attributes in square brackets and links. There are also special Object Constraint Language types: Collection, Set, Bag, and Sequence.
Record types(6.7) are UML classes with no operations and all attributes public. Composition is a good way to show fields in a record.
Unions(6.8) are best treated by generalizations (multiple inheritance).
Pointers(6.9) have no special UML type. Do not use "*" to indicate pointers in the UML! The aggregation link is the old way (shown below) for saying that one type of data has a pointer that refers to an object of another type. Make sure that (1) the name of the pointer is the role, (2) there is an arrow head, and (3) the multiplicity is 0..1. However, aggregation is not really intended to model pointers. Modern UML users just use an association with an arrow to show a pointer.
Class Work
[ 07q.html ]