Download presentation
Presentation is loading. Please wait.
1
Data Types and Abstraction
Chapter 5
2
Abstract Data Types Attributes of a Variable Name Address Value
Lifetime Scope Type Size
3
Variable Represents: - A set of values - A set of operations
4
Class Hierarchy
5
Object class - At the top of the class hierarchy
- All other classes are derived from Object, except Ownership
6
Object class Hierarchy
7
Object class Definition
8
Object operator definitions
9
Object class member function definitions
10
NullObject Singleton Class
- A concrete class derived from the Object abstract base class - A class which only have one instance
11
NullObject class definition
12
NullObject class member function definition
13
Wrapper<T> class definition
14
Wrapper<T> class member function definitions
15
Int, Char, Double, and String class definitions
16
Containers - An object that holds within it other objects
- Containers can be held in other containers
17
Container class definition
18
Container class member function definitions
19
Visitors - Interacts with Container class
- Derived from abstract class Visitor - Every visitor class has a different functionality
20
The Print Visitor
21
Visitor – IsDone()
22
Put() for Container
23
Iterators - Derived from abstract Iterator class
- An alternative to visitors - For every concrete container class – a concrete iterator
24
Iterator Class Definition
25
The NullIterator Class
26
NullIterator class member function definitions
27
Ownership class definition
28
Purge() of Container
29
SearchableContainer class definition
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.