Professional Documents
Culture Documents
Object Oriented Programming
Object Oriented Programming
Problem Description
“ …customers are allowed to have
different types of bank accounts,
deposit money, withdraw money and
transfer money between accounts”
Procedural Approach
bool MakeDeposit(int accountNum,float amount);
float Withdraw(int accountNum,float amount);
struct Account {
char *name;
int accountNum;
float balance;
char accountType;
};
Procedural Approach cont’d
Focus is on procedures
All data is shared: no protection
More difficult to modify
Hard to manage complexity
Procedural vs. Object-Oriented
Procedural Object Oriented
0110100
011101
010101
10011
1110101 11101
11010
10101
Object Oriented
Data and operations are grouped together
Account Interface:
Balance MakeDesposit
InterestYTD Transfer
Owner WithDraw
Account_number GetBalance
BankAccount myAccount;
myAccount = new BankAccount;
Objects and Classes
Class Object
Visible in source Own copy of data
code Active in running
The code is not program
duplicated Occupies memory
Has the set of
operations given in
the class
Classification
Animal
Mammal Reptile
Checking
Enjoy a variety of personal banking options from First American. The following
outlines a number of First American products. If you have any questions, please
visit any First American Branch or contact us.
Account