Abstraction: focuses on the external view of an object, identifying the essential features that distinguish it from all other objects.. Encapsulation: focuses on the implementation of e[r]
Trang 1Session 2 - Data Structures
Pointers and Arrays Derived Types Walkthroughs, Arrays, and Aggregates
Trang 2• Pointers and Arrays
– Pointers
– Arrays and Pointers
– Unmodifiable Arrays
– Unmodifiable Variables
• Structs
– Member Access
– Compactness
– Pass By Value
– Passing an Address
– Arrow Notation
– Copying
Trang 3• A Language for Complex Applications
– Complexity
– Three Languages
– A First Example
• Object Terminology
– Abstraction
– Encapsulation
– Hierarchy
– Modularity
• Compiling Modular Programs
– A demonstration
Trang 4• The four fundamental concepts applied in object-oriented software development are:
Abstraction: focuses on the external view of an object, identifying the essential features that distinguish it from all other objects
Encapsulation: focuses on the implementation of each object;
identifying the data that describes its state and developing the
algorithms that describe its behavior
Hierarchy: ranks and orders objects amongst other objects
Aggregation defines object-wise containment, while inheritance
defines class-wise ranking
Modularity: identifies physical components of a solution
Trang 5Pointers and Arrays
• Pointers and arrays are building blocks of data structures.
• "A data structure is a way of storing data
in memory so that it can be used
efficiently" Wikipedia (2007).
Trang 6In-Class Practice
• As an exercise, upgrade the accounting
example from the
follows:
– declare a struct that describes the data for a
single transaction
– define and use an instance of this derived type
to upgrade the original solution
Trang 7• Pointers and Arrays
– Pointers
– Arrays and Pointers
– Unmodifiable Arrays
– Unmodifiable Variables
• Structs
– Member Access
– Compactness
– Pass By Value
– Passing an Address
– Arrow Notation
– Copying
– In-Class Practice
Q&A