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

Info icon 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
Image of page 1

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

Outline Case Study: Scenario Problem Analysis Inheritance Hierarchy Superclass and Subclass Test and Client Program Summary 2
Image of page 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
Image of page 3

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

Outline Case Study: Scenario Problem Analysis Inheritance Hierarchy Superclass and Subclass Test and Client Program Summary 4
Image of page 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) .
Image of page 5

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern