tutorial10.pptx

# tutorial10.pptx - CSCI 1120 Introduction to Computing Using...

This preview shows pages 1–7. Sign up to view the full content.

CSCI 1120 Introduction to Computing Using C++ Tutorial 10: Account Inheritance Hierarchy Le LI SHB 1013 [email protected] 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Outline Case Study: Scenario Problem Analysis Inheritance Hierarchy Superclass and Subclass Test and Client Program Summary 2
Case Study 3 A bank try to efficiently represent customers’ bank a ccount by using OOP. Customers’ account usually has two operations Deposit money (called credit) Withdraw money (called debit) We discuss two specific types of accounts Savings accounts Checking accounts Should we define a class for each account? Customer account, savings account, and checking accoun t

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Outline Case Study: Scenario Problem Analysis Inheritance Hierarchy Superclass and Subclass Test and Client Program Summary 4
Problem analysis (a) 5 We find that the member functions and variable s among the accounts are overlapped . When designing two or more classes that are di fferent but share some common features, we us e inheritance . The customer account can be viewed as the bas e class (or, superclass) , then the savings account and checking account can be viewed as the deri ved classes (or, subclass) .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Problem analysis (b) 6 Base class: Account Data member: (type double ) to represent the account balance Constructor
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

0/0 PREVIEWS LEFT

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern