SlideShare una empresa de Scribd logo
1 de 24
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
Withdraw, deposit, transfer
Object Oriented
Customer, money, account
Mapping the world to software
Objects in the problem domain are mapped
to objects in software
Object Oriented
Data and operations are grouped together
Account
Withdraw
Deposit
Transfer
Interface:
Set of available operations
Data Encapsulation
class Account {
public:
float withdraw();
void deposit(float amount);
private:
float balance;
);
Advantages of Encapsulation
Protection
Consistency
Allows change
Objects and Classes
Classes reflect concepts, objects reflect
instances that embody those concepts.
Daria Jane BrittanyJodie
girlclassobject
Objects and Classes cont’d
A class captures the common
properties of the objects instantiated
from it
A class characterizes the common
behavior of all the objects that are its
instances
Objects and Classes cont’d
Class BankAccount
Balance
InterestYTD
Owner
Account_number
Balance 500
InterestYTD
Owner
Account_number
Balance 10,000
InterestYTD
Owner
Account_number
Operations
MakeDesposit
Transfer
WithDraw
GetBalance
Objects as instances of Classes
The world conceptually consists of objects
Many objects can be said to be of the same
type or class
 My bank account, your bank account, Bill Gates’
bank account …
We call the object type a class
Instantiation
An Object is instantiated from a Class
BankAccount myAccount;
myAccount = new BankAccount;
Objects and Classes
Class
 Visible in source
code
 The code is not
duplicated
Object
 Own copy of data
 Active in running
program
 Occupies memory
 Has the set of
operations given in
the class
Classification
Mammal
Rodent Primate Cats
Reptile
Animal
Squirel RabbitMouse
Classification
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.
Checking
•Bank a lot without spending a lot: ValueFirst® Checking.
•Few checks and prefer PC Banking or ATMs: Select Access.
•Earn interest on checking dollars: First Interest Checking
•You are 55 years or better: 55 & Better Silver
•Premium checking features with higher interest rates than a personal checking account: First
American Platinum Checking
•Write less than 10 checks per month, or bank through an ATM: Budget Checking.
•Younger than 24 years old and in school: Student Checking
•Less than 20 transactions per month (excluding ATM, POS, and CheckCard): First Account
•Make the most out of every dollar: Tailored Money Sweep
Classification
Checking Account
Value First Select Access First Interest
Savings Account
Account
Inheritance
A class which is a subtype of a more
general class is said to be inherited
from it.
The sub-class inherits the base class’
data members and member functions
Inheritance cont’d
A sub-class has all data members of its
base-class plus its own
A sub-class has all member functions of
its base class (with changes) plus its
own
Inheritance is meant to implement sub-
typing (don’t abuse it)
Abstraction
Management of complexity
Hierarchical classification:
is-a relationship: inheritance
has-a relationship: containment
Polymorphism
One interface
Multiple implementations
Inheritance
Method overloading
What is a good class ?
A class abstracts objects
A class should be non-trivial in the
context of the program (has data
structures and operations different from
other classes)
Summary
What is Object Oriented Programming?
Object-oriented programming is a method of
implementation in which programs are
organized as cooperative collections of
objects, each of which represents an instance
of some class, and whose classes are all
members of one or more hierarchy of classes
united via inheritance relationships

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Java applet
Java appletJava applet
Java applet
 
Polymorphism in oop
Polymorphism in oopPolymorphism in oop
Polymorphism in oop
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in Java
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Object Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaionObject Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaion
 
Array in c++
Array in c++Array in c++
Array in c++
 
Object oriented programming concepts
Object oriented programming conceptsObject oriented programming concepts
Object oriented programming concepts
 
Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentationObject Oriented Programming ppt presentation
Object Oriented Programming ppt presentation
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
OOP java
OOP javaOOP java
OOP java
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
 
Applets
AppletsApplets
Applets
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Object Oriented Programming Principles
Object Oriented Programming PrinciplesObject Oriented Programming Principles
Object Oriented Programming Principles
 
concept of oops
concept of oopsconcept of oops
concept of oops
 
Classes and Objects
Classes and Objects  Classes and Objects
Classes and Objects
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 

Destacado

15067420 space-mouse-rahul-raj
15067420 space-mouse-rahul-raj15067420 space-mouse-rahul-raj
15067420 space-mouse-rahul-raj
Srishti Sabharwal
 
Space mouse sameer kumar telikicherla
Space mouse   sameer kumar telikicherlaSpace mouse   sameer kumar telikicherla
Space mouse sameer kumar telikicherla
Sameer Telikicherla
 
Final ppt
Final pptFinal ppt
Final ppt
pramada
 

Destacado (20)

Data Mining and WareHousing
Data Mining and WareHousingData Mining and WareHousing
Data Mining and WareHousing
 
Odd Man Out and Series By Raju Makwana
Odd Man Out and Series By Raju MakwanaOdd Man Out and Series By Raju Makwana
Odd Man Out and Series By Raju Makwana
 
SEO Presentation
SEO PresentationSEO Presentation
SEO Presentation
 
BRAIN GATE
BRAIN GATEBRAIN GATE
BRAIN GATE
 
Characteristics of oop
Characteristics of oopCharacteristics of oop
Characteristics of oop
 
Nano med bot technology by manish myst ssgbcoet
Nano med bot technology by manish myst ssgbcoetNano med bot technology by manish myst ssgbcoet
Nano med bot technology by manish myst ssgbcoet
 
Space Mouse_Krishna Raj
Space Mouse_Krishna RajSpace Mouse_Krishna Raj
Space Mouse_Krishna Raj
 
Project presentation image compression by manish myst, ssgbcoet
Project presentation image compression by manish myst, ssgbcoetProject presentation image compression by manish myst, ssgbcoet
Project presentation image compression by manish myst, ssgbcoet
 
15067420 space-mouse-rahul-raj
15067420 space-mouse-rahul-raj15067420 space-mouse-rahul-raj
15067420 space-mouse-rahul-raj
 
Space mouse sameer kumar telikicherla
Space mouse   sameer kumar telikicherlaSpace mouse   sameer kumar telikicherla
Space mouse sameer kumar telikicherla
 
Space mouse And Space Mouse Pro
Space mouse And Space Mouse ProSpace mouse And Space Mouse Pro
Space mouse And Space Mouse Pro
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 
Slide for space mouse by manish myst, ssgbcoet
Slide for space mouse by manish myst, ssgbcoetSlide for space mouse by manish myst, ssgbcoet
Slide for space mouse by manish myst, ssgbcoet
 
Final ppt
Final pptFinal ppt
Final ppt
 
pill camera
pill camerapill camera
pill camera
 
SKYBUS TECHNOLOGY
SKYBUS TECHNOLOGYSKYBUS TECHNOLOGY
SKYBUS TECHNOLOGY
 
Space Mouse
Space MouseSpace Mouse
Space Mouse
 
Sky bus
Sky busSky bus
Sky bus
 
My seminar ppt SPACE MOUSE
My seminar ppt  SPACE MOUSEMy seminar ppt  SPACE MOUSE
My seminar ppt SPACE MOUSE
 
Pill camera ppt
Pill camera pptPill camera ppt
Pill camera ppt
 

Similar a Object Oriented Programming

Banks offer various types of accounts, such as savings, checking, cer.pdf
 Banks offer various types of accounts, such as savings, checking, cer.pdf Banks offer various types of accounts, such as savings, checking, cer.pdf
Banks offer various types of accounts, such as savings, checking, cer.pdf
akbsingh1313
 
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docxCSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
ruthannemcmullen
 
Ideal online bank
Ideal online bankIdeal online bank
Ideal online bank
szrehman
 
Ideal Online Banks
Ideal Online BanksIdeal Online Banks
Ideal Online Banks
szrehman
 

Similar a Object Oriented Programming (20)

Oops
OopsOops
Oops
 
Introduction to-ddd
Introduction to-dddIntroduction to-ddd
Introduction to-ddd
 
Hitchhiker systems deepdive
Hitchhiker systems deepdiveHitchhiker systems deepdive
Hitchhiker systems deepdive
 
Banks offer various types of accounts, such as savings, checking, cer.pdf
 Banks offer various types of accounts, such as savings, checking, cer.pdf Banks offer various types of accounts, such as savings, checking, cer.pdf
Banks offer various types of accounts, such as savings, checking, cer.pdf
 
Defining tasks for User Stories
Defining tasks for User StoriesDefining tasks for User Stories
Defining tasks for User Stories
 
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docxCSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
 
Requirements in Agile Projects (Brief Intro), by Razvan Radulian (RTPIIBA, 20...
Requirements in Agile Projects (Brief Intro), by Razvan Radulian (RTPIIBA, 20...Requirements in Agile Projects (Brief Intro), by Razvan Radulian (RTPIIBA, 20...
Requirements in Agile Projects (Brief Intro), by Razvan Radulian (RTPIIBA, 20...
 
Behavior Driven Development [10] - Software Testing Techniques (CIS640)
Behavior Driven Development [10] - Software Testing Techniques (CIS640)Behavior Driven Development [10] - Software Testing Techniques (CIS640)
Behavior Driven Development [10] - Software Testing Techniques (CIS640)
 
Commercial Banking - Challenges and Opportunities
Commercial Banking - Challenges and OpportunitiesCommercial Banking - Challenges and Opportunities
Commercial Banking - Challenges and Opportunities
 
Wise-Sync - Upside Down Accounting
Wise-Sync - Upside Down AccountingWise-Sync - Upside Down Accounting
Wise-Sync - Upside Down Accounting
 
Hitchhiker systems
Hitchhiker systemsHitchhiker systems
Hitchhiker systems
 
Kodas ir specifikacija: du zuikiai vienu šūviu
Kodas ir specifikacija: du zuikiai vienu šūviuKodas ir specifikacija: du zuikiai vienu šūviu
Kodas ir specifikacija: du zuikiai vienu šūviu
 
Library Windows Project
Library Windows ProjectLibrary Windows Project
Library Windows Project
 
On-chain Crowdfunding & Asset Token
On-chain Crowdfunding & Asset Token On-chain Crowdfunding & Asset Token
On-chain Crowdfunding & Asset Token
 
Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)Introduction to Domain driven design (LaravelBA #5)
Introduction to Domain driven design (LaravelBA #5)
 
Ideal online bank
Ideal online bankIdeal online bank
Ideal online bank
 
ch_5.pdf
ch_5.pdfch_5.pdf
ch_5.pdf
 
Best School Management Sotwares
Best School Management SotwaresBest School Management Sotwares
Best School Management Sotwares
 
Seq uml
Seq umlSeq uml
Seq uml
 
Ideal Online Banks
Ideal Online BanksIdeal Online Banks
Ideal Online Banks
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

Object Oriented Programming

  • 2. Problem Description “ …customers are allowed to have different types of bank accounts, deposit money, withdraw money and transfer money between accounts”
  • 3. Procedural Approach bool MakeDeposit(int accountNum,float amount); float Withdraw(int accountNum,float amount); struct Account { char *name; int accountNum; float balance; char accountType; };
  • 4. Procedural Approach cont’d Focus is on procedures All data is shared: no protection More difficult to modify Hard to manage complexity
  • 5. Procedural vs. Object-Oriented Procedural Withdraw, deposit, transfer Object Oriented Customer, money, account
  • 6. Mapping the world to software Objects in the problem domain are mapped to objects in software
  • 7. Object Oriented Data and operations are grouped together Account Withdraw Deposit Transfer Interface: Set of available operations
  • 8. Data Encapsulation class Account { public: float withdraw(); void deposit(float amount); private: float balance; );
  • 10. Objects and Classes Classes reflect concepts, objects reflect instances that embody those concepts. Daria Jane BrittanyJodie girlclassobject
  • 11. Objects and Classes cont’d A class captures the common properties of the objects instantiated from it A class characterizes the common behavior of all the objects that are its instances
  • 12. Objects and Classes cont’d Class BankAccount Balance InterestYTD Owner Account_number Balance 500 InterestYTD Owner Account_number Balance 10,000 InterestYTD Owner Account_number Operations MakeDesposit Transfer WithDraw GetBalance
  • 13. Objects as instances of Classes The world conceptually consists of objects Many objects can be said to be of the same type or class  My bank account, your bank account, Bill Gates’ bank account … We call the object type a class
  • 14. Instantiation An Object is instantiated from a Class BankAccount myAccount; myAccount = new BankAccount;
  • 15. Objects and Classes Class  Visible in source code  The code is not duplicated Object  Own copy of data  Active in running program  Occupies memory  Has the set of operations given in the class
  • 17. Classification 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. Checking •Bank a lot without spending a lot: ValueFirst® Checking. •Few checks and prefer PC Banking or ATMs: Select Access. •Earn interest on checking dollars: First Interest Checking •You are 55 years or better: 55 & Better Silver •Premium checking features with higher interest rates than a personal checking account: First American Platinum Checking •Write less than 10 checks per month, or bank through an ATM: Budget Checking. •Younger than 24 years old and in school: Student Checking •Less than 20 transactions per month (excluding ATM, POS, and CheckCard): First Account •Make the most out of every dollar: Tailored Money Sweep
  • 18. Classification Checking Account Value First Select Access First Interest Savings Account Account
  • 19. Inheritance A class which is a subtype of a more general class is said to be inherited from it. The sub-class inherits the base class’ data members and member functions
  • 20. Inheritance cont’d A sub-class has all data members of its base-class plus its own A sub-class has all member functions of its base class (with changes) plus its own Inheritance is meant to implement sub- typing (don’t abuse it)
  • 21. Abstraction Management of complexity Hierarchical classification: is-a relationship: inheritance has-a relationship: containment
  • 23. What is a good class ? A class abstracts objects A class should be non-trivial in the context of the program (has data structures and operations different from other classes)
  • 24. Summary What is Object Oriented Programming? Object-oriented programming is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships