You are on page 1of 38

CISP 400

Object Oriented
Programming in C++
Professor Fowler
Last Time

2
Agenda
Ch 7 - Object Oriented Programming
7.1 Abstract Data Types 7.8 Private member Functions

7.2 Object-Oriented 7.9 Passing Objects to Functions


Programming
7.10 Object Composition
7.3 Introduction to Classes
7.11 SKIP
7.4 Creating and using Objects
7.12 Structures
7.5 Defining Member Functions
7.13 More on Enumerated Data
7.6 Constructors Types

7.7 Destructors 8.13 Arrays of Objects

3
Theme for Today

4
“Method.”

5
Chapter 7
Object Oriented
Programming

6
Agenda
Ch 7 - Object Oriented Programming
7.1 Abstract Data Types 7.8 Private member Functions

7.2 Object-Oriented 7.9 Passing Objects to Functions


Programming
7.10 Object Composition
7.3 Introduction to Classes
7.11 SKIP
7.4 Creating and using Objects
7.12 Structures
7.5 Defining Member Functions
7.13 More on Enumerated Data
7.6 Constructors Types

7.7 Destructors 8.13 Arrays of Objects

7
Agenda
Ch 7 - Object Oriented Programming
7.1 Abstract Data Types 7.8 Private member Functions

7.2 Object-Oriented 7.9 Passing Objects to Functions


Programming
7.10 Object Composition
7.3 Introduction to Classes
7.11 SKIP
7.4 Creating and using Objects
7.12 Structures
7.5 Defining Member Functions
7.13 More on Enumerated Data
7.6 Constructors Types

7.7 Destructors 8.13 Arrays of Objects

8
Accountability Groups

9
Purpose

• Support each other around a common goal -


getting a good grade in this class.

10
First Meeting

• Exchange contact info (OK to use Canvas)

• Decide Leader (rotating, selected?)

• Decide on Group Name


(1st choice + Backup choice)

11
Activities
1. Quick Check - 1/2 words on how you’re doing.

2. Record your weekly goals (individual)

3. Did you achieve last week’s goals?


Yes - Lavish Praise
No - “How can we help?”

4. Take Roll (privately chat me who’s missing)

5. Make any arrangements to meet outside class.


- Missing Material
- Peer Review
- Study Groups

12
Program This
Exercise
Exercise Goals

• Increase Topic Mastery

• Construct Knowledge

• Give you data to evaluate how well you are


learning.

14
Programming Exercise
• Build a dynamic array of 10 ints on the heap. Assign a
value of 10 * index number to each element.

• Display the array.

• Wrap the following in a 5 count loop:

• Generate a random number. Even - add 1 element to the


array. Odd -subtract 1 element from the array.

• Print what happened.

• Print the entire loop again.

15
7.3 Introduction to
Classes

17
Photo Credit: https://qph.ec.quoracdn.net/main-qimg-021242ab769010da96e2a2ecb7fb266a
Photo Credit: https://3.bp.blogspot.com/-y8do_JdFx6c/V3_dywgZzPI/AAAAAAAAGZY/catSBAx1g-ciuT6LxvvnjYAfvEWH2jAmQCLcB/s1600/Wordane-OOP-car-class-eg-2.jpg
Photo Credit: https://iandunn.name/content/presentations/wp-oop-mvc/images/object-instantiation.png
7.4 Creating and
Using Objects

21
7.5 Defining Member
Functions

23
• Classes group data and associated behaviors.

• How do we create those behaviors?

24
• We use methods!

25
Methods

FORCED functions :. Forced abstraction.

Everything you learned about functions in CISP 360


apply.

26
Method
Another example
Coding Exercise

Create a Date class with private member ints day,


month, and year. Add a setDate() method to set the
date. Add a print public member function to display
the date.

Write a test rig to exercise this class.

30
What’s this section
about?

31
Agenda
Ch 7 - Object Oriented Programming
7.1 Abstract Data Types 7.8 Private member Functions

7.2 Object-Oriented 7.9 Passing Objects to Functions


Programming
7.10 Object Composition
7.3 Introduction to Classes
7.11 SKIP
7.4 Creating and using Objects
7.12 Structures
7.5 Defining Member Functions
7.13 More on Enumerated Data
7.6 Constructors Types

7.7 Destructors 8.13 Arrays of Objects

32
What’s Next?

33
Agenda
Ch 7 - Object Oriented Programming
7.1 Abstract Data Types 7.8 Private member Functions

7.2 Object-Oriented 7.9 Passing Objects to Functions


Programming
7.10 Object Composition
7.3 Introduction to Classes
7.11 SKIP
7.4 Creating and using Objects
7.12 Structures
7.5 Defining Member Functions
7.13 More on Enumerated Data
7.6 Constructors Types

7.7 Destructors 8.13 Arrays of Objects

34
Agenda
Ch 7 - Object Oriented Programming
7.1 Abstract Data Types 7.8 Private member Functions

7.2 Object-Oriented 7.9 Passing Objects to Functions


Programming
7.10 Object Composition
7.3 Introduction to Classes
7.11 SKIP
7.4 Creating and using Objects
7.12 Structures
7.5 Defining Member Functions
7.13 More on Enumerated Data
7.6 Constructors Types

7.7 Destructors 8.13 Arrays of Objects

35
Homework 2 due Sunday.

36
Modify This

37

You might also like