Object oriented data/code
Classes combine data with function(=methods) that operate on this data
- member (data): should be private.
- methods operate on these members (also with additional in/output
parameters)
- principle of encapsulation:
- the storage of member/data should be hidden from the user.
- only the action (=method) of them is seen from the outside.
- Basic methods:
- constructors: parameter constructors
- destructor
- Example:
intro_crsmatrix
(tar,
doc).
Templates
- write one code for many
data types.
- only header file is needed.
- compiler creates functions for all required
data types.
- function templates, class templates
STL (Standard Template Library)
- Container, algorithms, iterators
- iterators are the link between containers and algorithms on them.
- Containers (e.g.):
- Algorithms (e.g.):
- sort, unique, find, lower_limit,
- Methods on containers (e.g.):
- C.push_back()
- C.erase()
- C.insert()
Jan 27, 2019